Game Development Community

Schedule functions malfunctioning?

by Ted Lilljegren · in Technical Issues · 02/13/2008 (9:43 am) · 7 replies

The following schedule:
$stritS = Schedule(%stritTime, %name, "cancelStritStatus", $strit);
Where stritTime is random between 1000 and 10000 milisecs.
Returns values like:
808499216
when getScheduleDuration($stritS) is used.

I am using afx tge 1.52, slightly modded but i have not touched anything that deals with the schedules. The schedules seems to work fine otherwise. Is this some kind of know bug or something? The documenatation says that it will return an integer that represents its planned duration i milisceonds, which it kind of fails to do for me. Any ideas what might be up?

#1
02/13/2008 (1:15 pm)
What is the value of %name? It is a "reference object"
(see simbase.cc or ask in an SDK forum)

I have always used the null form of the schedule command, e.g.:
$stritS = Schedule(%stritTime, 0, "cancelStritStatus", $strit);


Having said that, I tried getScheduleDuration(0) and it returned zero.
I don't know what is happening here, but you might try the null reference object form if you don't really need it.
#2
02/13/2008 (1:22 pm)
I have tried null reference object prior to posting the thread, it is still the same way. And i think the reason that your console returned zero was because of you passing a faulty argument(you should have used $stritS, there currently are no schedules called "0" in this scenario.) If you try again with $stritS as argument, you might get something off the wall funky as i did.
#3
02/13/2008 (3:17 pm)
If one uses a %name="something that doesn't exist", the Schedule call returns $stritS = 0. That's what I was getting at with the last paragraph. (So messing up the %name wouldn't have the same error signature as what you are reporting, so that isn't it.)

I get interrupted so much when I post during the day that it is a miracle that even half my posts make sense... probably only the first halves! ;)
#4
02/13/2008 (3:23 pm)
Alright, i'd better chime in since i wrote that function and some other related to schedules.

I'll run a couple tests and see if something "broke" since i wrote it.

Is it being used properly?
www.garagegames.com/mg/forums/result.thread.php?qt=25457

That url has a few examples of how to use it...

In the mean time, i'll see what results i get.
#5
02/13/2008 (3:34 pm)
Alright, I tested and noticed an irregularity with both functions i wrote. I'm going to delve into the code and see what changed.

getTimeSinceStart gives a strange number as well, but it does infact count upwards.... must be an issue with the variable "startTime" that both functions use.
#6
02/13/2008 (3:52 pm)
Ok, somewhere along the lines, my extra code added to simmanager.cc disappeared

in simManager.cc around line 79 in PostEvent

event->time = time;
[b]   event->startTime=gCurrentTime; //Ramen Hack[/b]
   event->destObject = destObject;

This one line needs to be added in giving start time a real number to use. Without it, starttime is never given a value, and you get an erroneous value.

I've added this into my code and confirmed it works.
#7
02/14/2008 (12:09 am)
Incredible. I have not tested it yet but im without doubt that it will work. Thanks for the help and the quick reply. Strange that noone else had noticed it yet, its really usefull functions.