Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AGSMAN on Tue 29/04/2008 12:40:41

Title: Changing rooms (SOLVED)
Post by: AGSMAN on Tue 29/04/2008 12:40:41
I have a problem. I have made a hotspot over a door which i had drawn. I have made the walkable areas and all. And now i want the character to change room when the hotspot is interacted with. (the door) I have tried the Character.ChangeRoom (int room_2); line in the script editor but it doesnt work. Anyone have any tips?
Title: Re: Changing rooms
Post by: SSH on Tue 29/04/2008 13:03:03
use:


player.ChangeRoom(2);
Title: Re: Changing rooms
Post by: AGSMAN on Tue 29/04/2008 13:05:32
I did, an error says: There were compilation errors, see the output window for details.
Title: Re: Changing rooms
Post by: Matti on Tue 29/04/2008 13:19:00
Well, what does the output window say?
Title: Re: Changing rooms
Post by: AGSMAN on Tue 29/04/2008 13:19:55
I dont know where it is.
Title: Re: Changing rooms
Post by: Matti on Tue 29/04/2008 13:23:10
It should be right below the main screen (the script or the room or any other view)..

Are you using version 3.x?

The output window normally points to a specific line in the script where the error is located.
Title: Re: Changing rooms
Post by: AGSMAN on Tue 29/04/2008 13:26:59
Oh right, that one. It says: Failed to save room room1.crm; Details below
Error (Line1): unexpected '}'

Yes, i use version 3.0
Title: Re: Changing rooms
Post by: Matti on Tue 29/04/2008 13:32:27
Well, then please post your script here (not only line 1).

Probably there's a '}' too much or at a wrong position, but maybe something else is wrong.
Title: Re: Changing rooms
Post by: AGSMAN on Tue 29/04/2008 13:34:21
}
  player.ChangeRoom (2);
{
Title: Re: Changing rooms
Post by: Matti on Tue 29/04/2008 13:36:56
Haha. It's supposed to be { } and not } {

I think that should do it..
Title: Re: Changing rooms
Post by: Gilbert on Tue 29/04/2008 13:40:00
Don't know about the other parts of your script, but braces are arranged as {} NOT }{ :P. So, instead:

{
 player.ChangeRoom (2);
}


However, as it's reported that the } appears in line 1 of the script, you probably didn't put that part of the codes into a function of the desired event, so it probably won't work anyway. You need to put it inside the function generated by the interact hotsport event (as you mentioned in the first post).

Matt beated me but I'll just post anyway.
Title: Re: Changing rooms
Post by: AGSMAN on Tue 29/04/2008 13:42:48
I still dont get it to work, same error message.
Title: Re: Changing rooms
Post by: Matti on Tue 29/04/2008 13:47:55
Like Gilbot said:

Quote from: Gilbot V7000a on Tue 29/04/2008 13:40:00
you probably didn't put that part of the codes into a function of the desired event, so it probably won't work anyway. You need to put it inside the function generated by the interact hotsport event (as you mentioned in the first post).

So it should look like that (in the ROOMSCRIPT):

interact_hotspot...()
{
  player.ChangeRoom (2);
}
Title: Re: Changing rooms
Post by: AGSMAN on Tue 29/04/2008 13:52:17
I inserted that piece of code but it still wont work. Im sorry if i appear dumb but im a total newbie to AGS and dont have any coding experience.
Title: Re: Changing rooms
Post by: Matti on Tue 29/04/2008 13:57:21
Perhaps it would help if you could post the WHOLE roomscript.

Infact your hotspot-interaction can't be line ONE of your roomscript..
Title: Re: Changing rooms
Post by: AGSMAN on Tue 29/04/2008 14:07:38
Oh now i got it! Thanks everyone for helping! Oh by the way, where should i look for the .exe file i get when i click "build exe" I looked in the same folder as AGS is in, but didnt find it.
Title: Re: Changing rooms
Post by: Matti on Tue 29/04/2008 14:16:02
The .exe-file is in your game's folder which is usually in the AGS-folder..

Please modify your first post and put (solved) behind the title so everyone knows that there's no problem here anymore..