C++ schedule method?.
by Peterjohn Griffiths · in Torque Game Engine · 09/18/2006 (5:54 pm) · 10 replies
Hi,
I havn't touched C++ in a long time and I want to schedule the calling of a function 1 second later.
In torque script I would use
Many thanks
I havn't touched C++ in a long time and I want to schedule the calling of a function 1 second later.
In torque script I would use
//Schedule(millisecs, eventDependsOnThis, functionname) Schedule(1000, 0, "PlayNextDemoCall");I have tried google and the like but can't find what i'm after.
Many thanks
#2
09/18/2006 (7:12 pm)
I thought this would be a c++ native function?.
#3
(Of course - easiest thing to do would be as Gary suggested and read over how schedule actually works. :)
09/18/2006 (7:17 pm)
Schedule a SimEvent. You'll have to subclass it appropriately, of course. schedule uses SimConsoleEvent, which is a subclass of SimEvent.(Of course - easiest thing to do would be as Gary suggested and read over how schedule actually works. :)
#4
09/19/2006 (6:59 am)
Or if you're lazy like me.Con::executef ( 4, "schedule", 1000, 0, "function" );
#6
If it's already exposed to script that's not too bad an idea, obviously if you expose something to script justs so you can schedule it you might not be doing the smartest thing. ;)
09/19/2006 (11:23 am)
Hey, whatever works for people, right? :PIf it's already exposed to script that's not too bad an idea, obviously if you expose something to script justs so you can schedule it you might not be doing the smartest thing. ;)
#7
This is possible in other languages.
09/19/2006 (2:22 pm)
Isn't there anything supported natively by c++ itself?.This is possible in other languages.
#8
it is a Language.
there is nothing in the standard library that does anything like this.
09/19/2006 (2:42 pm)
C++ is not a programming API it is a Language.
there is nothing in the standard library that does anything like this.
#9
09/19/2006 (2:59 pm)
You can use SimEvent to get there. C++ has no native assumptions about time (it's a systems programming language after all - what good is a language for implementing a time service if it already has to have one to run?! :), so we solved it in context of Torque.
#10
Classic!
09/19/2006 (3:11 pm)
Quote:Or if you're lazy like me.
Con::executef ( 4, "schedule", 1000, 0, "function" );
Classic!
Torque Owner Gary "ChunkyKs" Briggs
ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command,
and
ConsoleMethod(SimObject,schedule, S32, 4, 0, "object.schedule(time, command,
Also, look in simBase.h for SimEvent:
You won't find the information on google because google shouldn't be able to index the source to torque, anywhere, ever :-)
Gary (-;