Hi Ya'll, new to Quest here, i've put about 30 hours or so into it so I know my way around. I know a few other coding languages from which I draw my knowledge and I am trying to do something but am not sure if A. its possible and B.what the correct syntax is.
I am trying to write a universal Run command where the user types "run" and they return to the room they were previously in. Im sure there's a more streamline way to do this but the way I went about this is to create an object called PreviousRoom with an attribute called PreviousRoomNumber. Every time the player exits a room, the PreviousRoomNumber updates to the number of the room they are exiting. (my rooms are named: Room 1, Room 2, Room 3, etc)
The problem occurs when I try to call upon this attribute. Right now, my code reads:
MoveObject (player, Room [GetInt(PreviousRoom,"PreviousRoomNumber")])
using  was just a guess I had from the other languages that I know. Could anyone help me out with the correct way to right this?
You could try:
MoveObject(player, GetObject("Room " + PreviousRoom.PreviousRoomNumber))
It would be helpful to know how you're setting PreviousRoom.PreviousRoomNumber. (And you don't have to create a new object for this. You can easily use hang the PreviousRoomNumber attribute off the game or player object, if you wish.)
Ah! wasn't aware i could throw an attribute into the game. But obviously that would be a much more streamline method :)
At the moment i'm just manually writing the script into each exit using "run a script on exit" using
'''set (PreviousRoom, "PreviousRoomNumber", 1)'''
where the room number is currently 1 (but would be whatever the current room number is)
@tbworld I put together something similar to this not too long ago but whether it does what you want depends on the specifics of how and when this function is coming into play. If you're willing to share a bit more of the details I can probably help work out some of the specifics.
Edited for clarity