|
|
Quellcode |
1 2 3 |
<action autorun='onstart'> callwith(hotspot[anhotspot], anaction);</action> <hotspot name='anhotspot' /> <action name='anaction' scope='local'> trace(caller.name); // anhotspot playsound(_name_, _source_, false, 1, trace(caller.name) ); // undefined or null</action> |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Kabkee« (12. Juli 2023, 08:34)
playsound(_name_, _source_, false, 1, trace(get(caller.name)) );
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »indexofrefraction« (12. Juli 2023, 09:00)
trace(caller.name); shows "anhotspot" as expected when you call the action with callwith()
its kind of logical that the playsound callback cant have anaction or anhotspot...
1) its not called from anaction() but from playsound()
2) such a callback is not a local scope action
but you can pass any information when you create/pass the callback
maybe that works:
calc(local.callback, "trace("+caller.name+")");
playsound(_name_, _source_, false, 1, get(callback));
|
|
Quellcode |
1 2 3 4 5 |
<action name='anaction' scope='local'> trace(caller.name); copy(global.callerName, caller.name); playsound(narration, get(sound_source[effect_popup].url), false, 1, trace(get(global.callerName)) ); </action> |
|
|
Quellcode |
1 2 3 4 5 6 |
<some_setting tempcaller='' /> <action name='anaction' scope='local'> trace(caller.name); copy(some_setting.tempcaller, caller.name); playsound(narration, get(sound_source[effect_popup].url), false, 1, trace(some_setting.tempcaller) ); </action> |
|
|
Quellcode |
1 2 3 |
maybe that works:
calc(local.callback, "trace("+caller.name+")");
playsound(_name_, _source_, false, 1, get(callback));
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<action autorun='onstart'>
callwith(hotspot[myhotspot], myaction);
</action>
<hotspot name='myhotspot' />
<action name='myaction' scope='local'>
trace('myaction() caller.name=',caller.name);
calc(local.callback, "trace('callback() "+caller.name+"')");
action_with_callback(get(callback));
</action>
<action name='action_with_callback' scope='local' args="callback">
trace('action_with_callback() callback=',callback);
callback();
</action>
|
strange.. it works fine here
proof of concept -->
![]()
Quellcode
1 2 3 4 5 6 7 8 9 10 11callwith(hotspot[myhotspot], myaction); trace('myaction() caller.name=',caller.name); calc(local.callback, "trace('callback() "+caller.name+"')"); action_with_callback(get(callback)); trace('action_with_callback() callback=',callback); callback();
Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von »indexofrefraction« (13. Juli 2023, 10:12)
Yes. that makes me sense. All about the local scope and callwith you said, I agree with them.
@ Kabkee
anyway, in any case only the direct caller is accessible! you cant get a higher caller
thats why the example above hardcodes the callers name inside the callback function
this way you have the needed information
why it is.|
|
Quellcode |
1 2 3 4 5 6 7 8 9 |
<action name='anaction'> set(getMyName, 'got YOU'); tween(view.hlookat, 90,,, trace(getMyName); // got YOU ); playsound(narration, get(sound_source[effect_popup].url), false, 1, trace(getMyName); // got YOU ); </action> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<action autorun='onstart'> callwith(hotspot[anhotspot], anaction); </action> <hotspot name='anhotspot' /> <action name='anaction' scope='local'> copy(getMyName, caller.name); tween(view.hlookat, 90,,, trace(get(getMyName)); // anhotspot ); playsound(narration, get(sound_source[effect_popup].url), false, 1, trace(get(getMyName)); // null ); </action> |