Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: obe on Sat 26/03/2005 22:37:47

Title: Back to previous room script?
Post by: obe on Sat 26/03/2005 22:37:47
I was wondering if what i have planned for a save/load menu is possible.
I'm trying to make a seperate screen with hotspots for save/load/new/return and my bro and i are
having problems figuring out if the "return" part is even possible to script.
We will be having several "save rooms" with the character hidden and eliminating the save option until you reach these rooms.

I guess what i'm getting at is making a return to previous room script or will we have to make a seperate save room for each save point?
(http://img.photobucket.com/albums/v48/obesolete/livinglester.gif)
(http://img.photobucket.com/albums/v48/obesolete/saveload.gif)
Title: Re: Back to previous room script?
Post by: Ashen on Sun 27/03/2005 04:22:48
Sounds like you want the character[CHARID].prevroom variable. (Character.PreviousRoom in 2.7) E.g.:

NewRoom (character[EGO].prevroom);
Title: Re: Back to previous room script?
Post by: obe on Sun 27/03/2005 07:35:03
awsome thanks.
now after fiddling with it for a while, how can i set the co-ords for my return?
Title: Re: Back to previous room script?
Post by: Ashen on Sun 27/03/2005 11:19:39
Best way to do it would be to store them in a couple of ints, or GlobalInts, before the room change:


SetGlobalInt (1, player.x);
SetGlobalInt (2, player.y);
NewRoom (SAVEROOM);


Then, when you leave the save room:

NewRoomEx (player.prevroom, GetGlobalInt (1), getGloablInt (2));