Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Wed 07/06/2006 00:54:09

Title: inventory as a room question
Post by: on Wed 07/06/2006 00:54:09
Hi I'm getting along really well with AGS, was hoping I wouldn't have to learn much scripting or ask too many questions. I got caught on a snag though.

I am trying to have character view an item (ipod) which brings it to a room with the functional ipod interface.
What I need to know since you can use the Ipod in any room,  how can I set it to return to the room that the item was viewed from? I couldnt find this in the knowledge base but it seems a basic enough task.
Title: Re: inventory as a room question
Post by: Nathan23 on Wed 07/06/2006 01:03:46
you should try the manual, but anyway:

you will need a global variable to save the number of the room where the ipod was, then you use the ChangeRoom function with your character, and the value of the room will be the global variable
Title: Re: inventory as a room question
Post by: Khris on Wed 07/06/2006 01:09:16
To be specific:
In the iPod's player enters screen (before fadein):
SetGlobalInt(1, player.PreviousRoom);

In the "exit iPod" interaction:
player.ChangeRoom(GetGlobalInt(1));
Title: Re: inventory as a room question
Post by: Nathan23 on Wed 07/06/2006 01:14:13
Yes, you can do it in that way ;)
works for me, try it
Title: Re: inventory as a room question
Post by: deftonesrule on Wed 07/06/2006 02:40:08
why not make it a gui ?
Title: Re: inventory as a room question
Post by: on Wed 07/06/2006 03:07:44
Thanks you guys thats exactly what I needed.

I haven't focused on custom gui's or NPC's yet but hopefully before the weeks over I'll have all the basics covered. I keep getting carried away in things like interactive tv, or this ipod. Its pretty addictive stuff. I just seem to be dyslexic when it comes to scripting so most of what I'm learning is through the default template.
Title: Re: inventory as a room question
Post by: SSH on Wed 07/06/2006 11:59:48
Quote from: KhrisMUC on Wed 07/06/2006 01:09:16
To be specific:
In the iPod's player enters screen (before fadein):
SetGlobalInt(1, player.PreviousRoom);

In the "exit iPod" interaction:
player.ChangeRoom(GetGlobalInt(1));

or even just:

In the "exit iPod" interaction:
player.ChangeRoom(player.PreviousRoom);