Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: arj0n on Tue 06/07/2010 12:48:59

Title: ChangeRoom(Current room) + 1
Post by: arj0n on Tue 06/07/2010 12:48:59
I'd like to have the playercharacter goto to the next room when the timer is expired.
Say I have 10 room and the player starts in room1.
After the timer has expired, the player should automatically go to room2.
After the timer has expired again, the player should automatically go to room3. And so on.
There should also be a check for the maximum room number [room 10 for now],
in order to quit the auto-change.room.

I tried:
function repeatedly_execute() {
if (IsTimerExpired(1)) player.ChangeRoom(cEgo.Room) + 1)

Which results in an error: GlobalScript.asc(74): Error (line 74): Parse error in expr near '1'

[I tried to achieve: changeroom('currentroom') + 1. Which doesn't seem to be ok]
Title: Re: ChangeRoom(Current room) + 1
Post by: Gilbert on Tue 06/07/2010 13:33:16
if (IsTimerExpired(1)) player.ChangeRoom(player.Room+1) ;