NewRoom/ChangeRoom

Started by Kal-El, Sun 16/10/2005 19:36:41

Previous topic - Next topic

Kal-El

This is the first time I've used AGS since the updates.

I was so used to the NewRoom function and upon finding out about this new ChangeRoom function, I'm completely lost.

I feel so embarassed because I was fluent in AGS before this and now, well, lol, y'know, I just feel silly.

But my problem is this -

All I want to do, believe it or not, is change from one room to the other.

This is for the main logo title screen to the menu screen so there's no characters that need moving or anything.

Before I could simply put NewRoom (2) or whatever but now when I put ChangeRoom (2) I get nothing but error messages about Undefined Tokens.

Please help me, I feel a right plonker!!!

Ubel

QuoteChangeRoom
(Formerly known as NewRoom, which is now obsolete)
(Formerly known as NewRoomEx, which is now obsolete)
(Formerly known as NewRoomNPC, which is now obsolete)

Character.ChangeRoom(int room_number, optional int x, optional int y)

Changes the room that the character is in.
If you call this on the player character, then the current room is unloaded from memory and ROOMx.CRM is loaded instead, where X is room_number.

IMPORTANT: This command does not change the room immediately; instead, it will perform the actual room change once your script function has finished (This is to avoid problems with unloading the script while it is still running). This means that you should not use any other commands which rely on the new room (object positionings, and so on) after this command within the same function.

If you call this on a non-player character, then they are instantly transported to the new room number.

Optionally, you can include an X and Y co-ordinate (you must include either both or neither). If you do so, then the character will also be moved to the specified co-ordinates in the new room.


For example, if your character's script name is EGO:

cEgo.ChangeRoom(2);

or

character[EGO].ChangeRoom(2);

Kal-El

Thanks for replying but that's not what I mean...

I've read the help file over and over but don't know how to change room WITHOUT a character...i.e., the logo screen to the menu screen doesn't have a character to move so how do I code that?

I much appreciate this help.

Ubel

The player character always exists in the room you are in. Even if you don't see it, it still is there. That's how the ChangeRoom function works. It tranfers a charater from one room to other. That's how the NewRoom function also worked. It transferred the player character into another room.

monkey0506

#4
And, the word player is a reference (pointer) to the player character, so you don't have to know the player's name at any given point.  Just use player.ChangeRoom(2);.

HeirOfNorton

To clarify, it is true that the player character exists in any room that you can see. In order to have a room without the player visible, you have to go into the room settings and check the "Hide player character" option. That's the general way to do Intro/title/menu screens.

HoN

Kal-El

Thanks you guys!

Yeah, I figured it out before looking back on here, lol...My mind just went totally blank! I suppose that's what happens when you don't use AGS for about 2 years lol.

Cheers anyway, much appreciated! :)

SMF spam blocked by CleanTalk