Page 1 of 1

How do I use a timer?

PostPosted: Wed Jan 02, 2013 12:47 am
by bamby1983
I want to insert a time delay between the moment my game begins and when a particular series of actors become visible. I understand there is a create timer function, but I do not know how this is to be used. How can I use this timer to insert time delays between events? Also, can this be used to perform a periodic check on certain parameters/variables?

Re: How do I use a timer?

PostPosted: Wed Jan 02, 2013 4:11 am
by skydereign
You create timers for actors (CreateTimer), and create timer events (triggered when a timer is finished). So to use timers you need to create timer events.

Re: How do I use a timer?

PostPosted: Wed Jan 02, 2013 5:32 am
by bamby1983
skydereign wrote:You create timers for actors (CreateTimer), and create timer events (triggered when a timer is finished). So to use timers you need to create timer events.

Thanks. Is there some sort of tutorial with sample code or screenshots I can refer to as an example of how this process needs to be applied? I couldn't find anything specific on the forums or within the script reference.

Re: How do I use a timer?

PostPosted: Wed Jan 02, 2013 8:52 am
by skydereign
Timers are pretty straightforward, which is probably why you didn't find anything. There is a gedt (gameEditor tutorial) for it though. You can access this tutorial from [Help]->[Events and Actions]->[Timers]. I'll try adding a wiki page for it a little later though. Anyway, it is just the following.
First you have to create a timer. This can only be done by choosing CreateTimer in an action (for instance selecting CreateTimer in the script editor).
After being prompted by the CreateTimer dialog, select the empty box, and choose [New Timer].
From there give the timer a name, and set whichever properties you want.
Click [Okay] to create the timer, and then click [Add] to actually add the code.
Now gE understand you have a timer, and will let you create timer events.
To create a timer event, go to the actor control panel and create an event like you normally would. Select Timer.
Pick the timer you want the event to be triggered by, and write the code or actions you want to be triggered.

You can call the CreateTimer function for any actor, but it will only do something for actors that have an event for the timer.

Re: How do I use a timer?

PostPosted: Sun Jan 06, 2013 1:26 am
by bamby1983
Thanks Sky! It works now! :D