Game Development Community

Basic scripting questions.

by Joe Nobody · in Torque Game Engine · 11/12/2003 (7:40 pm) · 3 replies

1. Why do all of the parameters for script functions use the modulus % operator.

2. The game loop...Where is it? Is it in code or script, If I create functions how do I ensure they get called every Tick if need be.

3. The this object. What is it? Where does it get initialized?

Thanks for any help with these questions.

#1
11/12/2003 (8:20 pm)
1. %foo indicates that foo is a local variable, not modulus.
2. It's in the platform layer somewhere. I'd use schedule if I wanted a script function to get called back, or else put code in the processTick of an object.
3. In script, %this is the first parameter to a method of an object. It's sometimes called %db. Name isn't important; that it is the first parameter is.
#2
11/12/2003 (9:07 pm)
Quote:If I create functions how do I ensure they get called every Tick if need be
I really dont recommend doing this in scripts. Scripts are REALLY slow compared to C++ code, so of you want to execute a function every tick, then you want to put that in the C++ code, or else it would slow the game down considerably (depending on what your doing of course).

yeah, the % sign is to differentiate from global variables (defined with the $ sign, or no sign). It can still be used as a modulus however.
#3
11/13/2003 (12:25 pm)
Thanks for the info, It helps alot. I found a Tutorial, on basic scripting stuff thats very good. Thanks again