I cant make my timers work

Started by vrazumijin, Fri 24/04/2020 05:59:24

Previous topic - Next topic

vrazumijin

Hello

Im trying to make my character change room after entering for the first time, seen a text displayed and wait for, lets say 4 seconds. I do it like this

Code: ags

// room script file

function room_FirstLoad()
{
Overlay.CreateTextual(20,133,0, Game.SpeechFont, 15,"El 28 de julio de 1914,despues de siglos de tensiones, estalla una gran guerra en Europa.");  
SetTimer(1,160);
if (IsTimerExpired(1)) {
player.ChangeRoom(2);
}

}





It builts, but just never changes to room 2.

I cant see what I'm doing wrong, could someone help please?

Privateer Puddin'

It needs to be set in repeatedly execute. Currently, you're setting the timer to 160 loops, but then checking whether it's expired immediately after.

vrazumijin

thanks

and how can I set the timer check in a repeatedly execute mode?

Privateer Puddin'

In the room editor, set a 'Repeatedly execute' event (this should add a function room_RepExec() bit to your room script, where you can add the IsTimerExpired)

vrazumijin

ok, now I get it

thank you so much

SMF spam blocked by CleanTalk