Delay timer
by mb · in Torque Game Engine · 10/06/2006 (6:52 pm) · 5 replies
I'm trying to create a delay timer to basically wait 10 seconds or whatever then do something. i was looking in $Sim::Time and wasnt having much luck. whats the best way to do this?
thanks in advance
thanks in advance
#2
10/07/2006 (7:31 am)
Thanks!
#3
function serverCmdJoinTeam(%client, %teamid)
{
schedule(1000, 0, joinTeam, %this, %teamid);
}
in console it will say:
joinTeam : Unknown command.
but this works (without schedule):
function serverCmdJoinTeam(%client, %teamid)
{
%client.joinTeam(%teamid);
}
I've gotten it to work without client/server commands but i don't think its the proper way to do it... so i'm wondering how can i call that function using schedule in commands.cs? I cant seem to get it in scope.
the function looks like this in game.cs:
function GameConnection::joinTeam(%this, %teamid)
10/07/2006 (9:20 am)
When i try to use schedule from a serverCmd in command.cs it cant find the function I'm calling. this is all being called from a gui btw. (teamplay tutorial)function serverCmdJoinTeam(%client, %teamid)
{
schedule(1000, 0, joinTeam, %this, %teamid);
}
in console it will say:
joinTeam : Unknown command.
but this works (without schedule):
function serverCmdJoinTeam(%client, %teamid)
{
%client.joinTeam(%teamid);
}
I've gotten it to work without client/server commands but i don't think its the proper way to do it... so i'm wondering how can i call that function using schedule in commands.cs? I cant seem to get it in scope.
the function looks like this in game.cs:
function GameConnection::joinTeam(%this, %teamid)
#5
i ended up calling another function in TeamSelectDlg.cs like so:
function suicideJoinTeam(%teamid)
{
commandtoserver('Suicide');
schedule(10000,0,jointeam,%teamid);
Canvas.popDialog(TeamSelectDlg);
//Hide the dialog once selection was made
}
function jointeam(%teamid)
{
commandtoserver('JoinTeam', %teamid);
//Canvas.popDialog(TeamSelectDlg);
//Hide the dialog once selection was made
}
10/07/2006 (11:41 am)
I couldnt ever get %client.schedule to work but I did get it working, so thanks :Di ended up calling another function in TeamSelectDlg.cs like so:
function suicideJoinTeam(%teamid)
{
commandtoserver('Suicide');
schedule(10000,0,jointeam,%teamid);
Canvas.popDialog(TeamSelectDlg);
//Hide the dialog once selection was made
}
function jointeam(%teamid)
{
commandtoserver('JoinTeam', %teamid);
//Canvas.popDialog(TeamSelectDlg);
//Hide the dialog once selection was made
}
Torque 3D Owner Peter Simard
Default Studio Name