Change to way you call world functions

Posted by Nick Gammon on Wed 13 Nov 2002 03:07 AM — 1 posts, 5,242 views.

Australia Forum Administrator #0
A few versions back (version 3.27) the way the scripting engine works was changed in a subtle way.

The change is that it assumes "world" in front of things if it can. What this means in practice is that these two examples are the same:


sub mytrigger (a, b, c)

   world.note "trigger called"
   world.colournote "white", "red", "Beware!"
   world.send "go north"

end sub


New method ...


sub mytrigger (a, b, c)

   note "trigger called"
   colournote "white", "red", "Beware!"
   send "go north"

end sub


Notice how the second example is shorter and a bit easier to read. This also works in Jscript and Perlscript.

Thus you can use the shorter version in your scripts providing you are sure they will run in 3.27 onwards (set as the "required version" in your plugin header).