Changing rooms (SOLVED)

Started by AGSMAN, Tue 29/04/2008 12:40:41

Previous topic - Next topic

AGSMAN

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?

SSH

use:

Code: ags

player.ChangeRoom(2);
12

AGSMAN

I did, an error says: There were compilation errors, see the output window for details.

Matti

Well, what does the output window say?

AGSMAN

I dont know where it is.

Matti

#5
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.

AGSMAN

Oh right, that one. It says: Failed to save room room1.crm; Details below
Error (Line1): unexpected '}'

Yes, i use version 3.0

Matti

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.

AGSMAN

}
  player.ChangeRoom (2);
{

Matti

Haha. It's supposed to be { } and not } {

I think that should do it..

Gilbert

Don't know about the other parts of your script, but braces are arranged as {} NOT }{ :P. So, instead:
Code: ags

{
  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.

AGSMAN

I still dont get it to work, same error message.

Matti

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);
}

AGSMAN

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.

Matti

Perhaps it would help if you could post the WHOLE roomscript.

Infact your hotspot-interaction can't be line ONE of your roomscript..

AGSMAN

#15
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.

Matti

#16
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..

SMF spam blocked by CleanTalk