How do I use a timer?

Questions, comments and discussion about the Game Editor development.

How do I use a timer?

Postby bamby1983 » Wed Jan 02, 2013 12:47 am

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?
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score

Re: How do I use a timer?

Postby skydereign » Wed Jan 02, 2013 4:11 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: How do I use a timer?

Postby bamby1983 » Wed Jan 02, 2013 5:32 am

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.
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score

Re: How do I use a timer?

Postby skydereign » Wed Jan 02, 2013 8:52 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: How do I use a timer?

Postby bamby1983 » Sun Jan 06, 2013 1:26 am

Thanks Sky! It works now! :D
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron