Difference between revisions of "Simulating new functions"
made last set of scripts safer
imported>Maian |
imported>Maian (made last set of scripts safer) |
||
Line 149: | Line 149: | ||
begin OnActivate | begin OnActivate | ||
Message "start func", 1 | if IsActionRef Player != 1 | ||
Message "start func", 1 | |||
set result to param1 + param2 | |||
Message "end func: %.0f", result, 1 | |||
else | |||
Activate | |||
endif | |||
end</pre> | end</pre> | ||
Calling script: | Calling script: | ||
<pre>scn | <pre>scn testobjscript | ||
float r | float r | ||
ref self | |||
begin Onload | |||
set self to GetSelf | |||
end | |||
begin OnActivate | begin OnActivate | ||
Line 164: | Line 173: | ||
set testfuncref.param1 to 10 | set testfuncref.param1 to 10 | ||
set testfuncref.param2 to 20 | set testfuncref.param2 to 20 | ||
testfuncref.Activate | testfuncref.Activate self, 1 | ||
set r to testfuncref.result | set r to testfuncref.result | ||
Message "after call: %.0f", r, 1 | Message "after call: %.0f", r, 1 |