continuous counter
by Louis Marchant · in Torque 3D Beginner · 10/25/2012 (7:59 am) · 3 replies
me again ;) lol
just a quick question, i have a variable that needs to increment every xx ammount of time
but i neede ti to do this always, all the time, whole game, no conditions to it.
not sure where to go on this.
just a quick question, i have a variable that needs to increment every xx ammount of time
but i neede ti to do this always, all the time, whole game, no conditions to it.
not sure where to go on this.
About the author
#2
but i think u have to add code anywhere of main.cs from game folder.
better u add it at the end of onStart() function
$a=0;
$time=10000;//10 sec
function func()
{
$a++;
}
schedule(1000, 0, "func"); // 1000ms = ~1 second
i am not near my pc.so this code not tested.may be last line need some fix.look into script manual for correct prototype of schedule().
[edit]
michael's one perfect
10/25/2012 (8:23 am)
note sure.but i think u have to add code anywhere of main.cs from game folder.
better u add it at the end of onStart() function
$a=0;
$time=10000;//10 sec
function func()
{
$a++;
}
schedule(1000, 0, "func"); // 1000ms = ~1 second
i am not near my pc.so this code not tested.may be last line need some fix.look into script manual for correct prototype of schedule().
[edit]
michael's one perfect
#3
10/25/2012 (8:35 am)
thanks Michael, works a treat :)
Associate Michael Hall
Distracted...
//somewhere after the game starts: incrementCounter(); function incrementCounter() { $someVariable++; schedule(1000, 0, "incrementCounter"); // 1000ms = ~1 second }