View Full Version : using setTimer() without calling it explicitly?
7th Jun 2004, 05:03 AM
I have a logic error, meaning Im lost. I want to have a method executed every 0.1 of a second, regardless of what else might be happening. (this is SP only, no network replicatation is being used)
eg setTimer(0.1, true)
I read up on Tick() and Timer() but they don't seem do it? I don't really know, as I said, I'm lost.
Any help is greatfully appreciated
7th Jun 2004, 05:32 AM
If you want to have code executed periodically, SetTimer and the Timer event are exactly what you need. If you think they don't, please elaborate...
7th Jun 2004, 07:37 AM
thanks Mychaeel, for the speedy reply, Ive got it working, I just didn't realise what I needed to do, - use the timer() event
So I put a timer() event in my controller class and call the method I want to happen every 0.1 second and it works... :mad: I have no idea why, I've STFW and I've ended up blindly hacking code, (which I truely detest), which works, and I dont know why.. I have no clue as to why this timer event does this, it just works. Can someone please explain why (how) the timer works?
AFAIK I am (I think unreal calls it) shadowing the timer() event, by writing a new Timer() event in my controller child, instead of actor.timer(). How is this allowable? I can now fix my code so it uses this timer event properly, but I would love an explaination of how it works
7th Jun 2004, 07:56 AM
AFAIK I am (I think unreal calls it) shadowing the timer() event, by writing a new Timer() event in my controller child
No, you're just overwriting it.
SetTimer sets up the Actor variables TimerRate and bTimerLoop. Each time the Actor is ticked (by the engine), its TimerCounter variable is incremented until it reaches the value of TimerRate; then the Timer event is executed, and TimerCounter is reset (and TimerRate too if bTimerLoop is False).
Since in the Unreal engine all method calls are virtual, the engine actually calls your overwritten Timer event rather than the one originally declared in Actor. If you want to make sure that the code in the inherited Timer method is called too, call Super.Timer() somewhere in your own Timer code.
7th Jun 2004, 08:38 AM
Thank you very much for the explaination. :D
vBulletin® v3.8.7, Copyright ©2000-2014, vBulletin Solutions, Inc.