Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: guns4party on Thu 10/07/2008 00:21:10

Title: change room script not working!
Post by: guns4party on Thu 10/07/2008 00:21:10
I am new to AGS this is my first time using it i have the newest version. I lookked up it the contents what the player.changeroomautoposition thing and tryed it in bolth the walk off bottom edge event and leave room event. If you are wondering the exit is on the bottom and i checked the walk space the edges everything i checked my code it seemed right I just can't find the problem. The poblem is i cant go from room to room i tried using the code:   

function room_Leave()
{
player.ChangeRoomAutoPosition(2);
}                                                           
               then i tried:                                   
function room_LeaveBottom()
{
player.ChangeRoomAutoPosition(2);
}                              i did not get an error message my charecter just wont go into the
next room oh and i dont no if this will effect anything but the demetions of the two rooms are different

   P.S. If you figured out this has horrible punctuation I know Im in a hurry. please exuse the bad punctuation. thanks for all the help.
Title: Re: change room script not working!
Post by: Matti on Thu 10/07/2008 00:32:03
 ??? You said what you've tried out but you didn't say what your problem is...
Title: Re: change room script not working!
Post by: GarageGothic on Thu 10/07/2008 01:00:49
I'm guessing the problem is that the character doesn't change rooms, matti :)

Could you please post your code, guns4party? Otherwise it's difficult to tell what is wrong. You should also write whether you get an error message or the event just isn't being triggered.
Title: Re: change room script not working!
Post by: guns4party on Thu 10/07/2008 01:47:01
Quote from: matti on Thu 10/07/2008 00:32:03
??? You said what you've tried out but you didn't say what your problem is...
its in the title i didnt think I'd have to put it sorry im new at this ii cant get my charecter to change from roomm one to room 2 the exit of room 1 to room2 is one the bottom
Title: Re: change room script not working!
Post by: MashPotato on Thu 10/07/2008 03:41:41
Have you changed the positions of the edges of the room?  Maybe your player isn't changing rooms because it never "leaves" the area :)

EDIT: oops, I think I misread your post and now see you've checked the room edges; however, if the bottom edge is too far down it might cause a problem, have you tried moving the bottom edge up a bit? :)
Title: Re: change room script not working!
Post by: guns4party on Thu 10/07/2008 04:29:50
Quote from: MashPotato on Thu 10/07/2008 03:41:41
Have you changed the positions of the edges of the room?  Maybe your player isn't changing rooms because it never "leaves" the area :)

EDIT: oops, I think I misread your post and now see you've checked the room edges; however, if the bottom edge is too far down it might cause a problem, have you tried moving the bottom edge up a bit? :)
to check it i put the bottom edge in the middle of the room so to be sure it would cross the edge ive made sure ive savedd the edges i think its a problem with the code but then again i have no idea
Title: Re: change room script not working!
Post by: Gilbert on Thu 10/07/2008 06:50:14
How did you make that "room_Leave()" function? Did you just type it directly in the script?
Title: Re: change room script not working!
Post by: guns4party on Thu 10/07/2008 21:05:47
Quote from: Gilbot V7000a on Thu 10/07/2008 06:50:14
How did you make that "room_Leave()" function? Did you just type it directly in the script?

i went to the events tab clicked the ... button in tthe leaves room line and typed player.changeplayerautoposition(2); i did get him to go to room2 but i  had to put in the pick up key scropt instead of him walking out of the edges but unfortunatly thats not how i want it but if all else fails its not thats big of a deal
Title: Re: change room script not working!
Post by: Khris on Thu 10/07/2008 23:46:46
Afaik, room_Leave() is executed immediately before the (already called, queued) room-change event is; it is meant to clean up a room before it is left.

Make sure the walkable area enables the character to step beyond the yellow border, then put the player.ChangeRoom line in the according one of the four edge functions.
Title: Re: change room script not working!
Post by: RetroJay on Wed 16/07/2008 23:48:03
Hi Khris.
It's me again! ;D
As you know I am using AGS 2.72.
I am also having probs with changing rooms. Since learning more about scripting I have been changing everything to script rather than using the predifined lines within the editor. However in the editor it says "Player - Go to a different room (12,0)" which works just fine. The player leaves the left side of the screen and appears in the next room on the right side.
But when I change this to pure script "player.ChangeRoom(12);" as it states in the "Text script equivalent code" the player leaves the left side of the room and appears in the next room on the left side (Which is wrong as he is then stuck in a wall).
The only way I can get it to work is to assign X and Y cords to "player.ChangeRoom(12,309,157);"
Is this the way to do it or am I missing something here?

Thanks. Jay.
Title: Re: change room script not working!
Post by: Khris on Thu 17/07/2008 00:46:09
Yep, that's the way to do it.
Via the IE (and without stating coords), the character is automatically moved to the opposite screen edge, then put on the nearest WA.
Via script, you have to state coords or the player won't change position.
Title: Re: change room script not working!
Post by: RetroJay on Thu 17/07/2008 01:11:52
Yet again.

Thanks Khris.

What would I do without your knowledge.

Let it be known that when my game is finally finished your name will be on the credits numerous times.
Don't hold your breath though as I keep having new ideas that just keeps making my game harder to make.
I think for my next one I should maybe write a story rather than just make it up as I go....What do you think? ;)

Thanks. Jay.