so for a basic timed loop, other languages you can just do some form of
while(true)
{
//dostuff
sleep(1000);
}
Torque is single threaded, so doing something like that would cause your game to hang
instead in Torque, for a general time delayed loop, use
function loopingFunction()
{
cancel($loop);
//dostuff
$loop = schedule(1000, 0, loopingFunction);
}
but that uses a global variable, so only one loop would run on the server at the time
since you're doing a hunger thing, you may want to have either one global loop which then loops through players and does stuff to them, or a loop per client
function loopingFunction()
{
cancel($loop);
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
//dostuff
}
$loop = schedule(1000, 0, loopingFunction);
}
or
function loopingFunction(%client)
{
cancel(%client.loop);
//dostuff
%client.loop = schedule(1000, 0, loopingFunction, %client);
}
do note that you can find all of this in previous addons and/or by searching coding help