Blockland Forums > Modification Help
Schedule Help!
A Person.:
Sorry I have been posting so much, I am just learning TorqueScript.
Anyway, I am making a simple script that counts seconds but it's not working. It just says "Seconds: 1" the entire time.
Here is the code:
--- Code: ---package Test {
function serverCmdStartTest(%seconds) {
tick();
}
function tick(%seconds) {
%seconds++;
bottomPrintAll("\c6Seconds: \c0"@%seconds ,2);
schedule(1000,0,tick);
}
};
activatePackage(Test);
--- End code ---
Triple Nickels:
in a sechedule, it is formatted:
schedule( time in milliseconds, 0, function to call, variables, variables, variables );
so, to fix this near the bottom you'd do
--- Code: ---function serverCmdStartTest(%seconds) {
tick();
}
function tick(%seconds) {
%seconds++;
bottomPrintAll("\c6Seconds: \c0"@%seconds ,2);
schedule(1000,0,tick,%seconds);
}
--- End code ---
also; you don't need to package it.
by the way; you're probably not very picky but i've noticed that torque isn't quite so precise with its timings. when I made a clock mod earlier back, after several (6+) hours, itd tick the next minute about 15 seconds late.
A Person.:
--- Quote from: Triple Nickels on June 12, 2010, 01:46:54 PM ---in a sechedule, it is formatted:
schedule( time in milliseconds, 0, function to call, variables, variables, variables );
so, to fix this near the bottom you'd do
--- Code: ----snip-
--- End code ---
also; you don't need to package it.
--- End quote ---
Thank you! I know, I just package them because of my OCD. =\
Triple Nickels:
--- Quote from: A Person. on June 12, 2010, 01:53:28 PM ---Thank you! I know, I just package them because of my OCD. =\
--- End quote ---
wat? packaging would make it less efficient so your OCD should make it so you don't package it.
A Person.:
--- Quote from: Triple Nickels on June 12, 2010, 01:56:21 PM ---wat? packaging would make it less efficient so your OCD should make it so you don't package it.
--- End quote ---
Lol, but sometimes things need to be packaged though.