reading timer

SamIam
I don't understand the timer. I want to put in 'if the timer's value = 5 then do whatever. If the timer's value=10 then do something else.' I'm just not getting how to put this in the 'if statement'

Alex
A timer simply "ticks" regularly - it doesn't "count up" by itself. To make a timer count up, you need increase the value of an attribute each time it ticks.

For example, in the timer script, use the "set a variable or attribute" to set "game.my_timer_count = game.my_timer_count + 1".

However, there are probably easier ways of doing what you want to achieve. Instead of using a timer at all, you can probably use "Run script after a number of seconds". So you could run one script after 5 seconds, and another script after 10 seconds.

Hope that makes sense - if you let us know exactly what you're trying to do I can give you more specific advice.

SamIam
I am making a very easy game for kids to get interested in reading. It is Mother Goose Nursery rhymes. One is Little Miss Muffet. I want a spider to slowly come down and sit on the tuffet. I want the player to get the feeling of something watching them and then have the spider plop onto the tuffet. I have another problem. If the player sits then leaves and comes back to sit again, it will say "you are already sitting". I need to detect the player leaving so they can sit again.

Alex
In that case I think the "run a script after a number of seconds" option is probably better than the timer.

How have you implemented the "you are already sitting" - some kind of flag? You could run a script when the player enters the room to unset the flag perhaps.

SamIam
I made a sit verb and then set a flag but I need it apply to all places the player sits not just one room.

Alex
In that case, you want to run the script every time the player moves room.

To do this, you'll need to edit one of the attributes of the "player" object. Go to the Attributes tab and select "changedparent" from the list (it's one of the grey ones). Click "Make Editable Copy", and then you'll be able to add script either before or after the call to "OnEnterRoom".

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums