Difference between revisions of "Simulating new functions"
no edit summary
imported>Maian |
imported>Kkuhlmann |
||
Line 52: | Line 52: | ||
--[[User:Maian|Maian]] 03:59, 18 April 2006 (EDT) | --[[User:Maian|Maian]] 03:59, 18 April 2006 (EDT) | ||
I'm just kind of brainstorming here, but you might try making a quest, marked "Allow repeated stages" so you can call the stages repeatedly, and make (say) stage 10 be your "function". Quest stage results are executed immediately, while the current script is processing, so you wouldn't have to wait for the results. | |||
Keep your variables in your quest script. In stage 10 results, you'd have: | |||
<pre> | |||
Message "start func", 1 | |||
set testfunc.result to testfunc.param1 + testfunc.param2 | |||
Message "end func: %.0f", testfunc.result, 1 | |||
</pre> | |||
To call this function, you'd do the following: | |||
<pre>scn testscript | |||
float r | |||
begin OnActivate | |||
Message "before call", 1 | |||
set testfunc.param1 to 10 | |||
set testfunc.param2 to 20 | |||
setstage testfunc 10 ; call the "function" | |||
set r to testfunc.result | |||
Message "after call: %.0f", r, 1 | |||
end | |||
</pre> | |||
I think this should work (I haven't tried it). | |||
--[[User:Kkuhlmann|Kkuhlmann]] 14:02, 18 April 2006 (EDT) | |||
[[Category:Questions]] | [[Category:Questions]] |