How do you move an object between rooms

Is there anyway I can move an object from room A to room B or from the current room to another room? Quest seems to allow an object to be moved to the current room.
For example a mouse might move from room A to room B.


An object's parent attribute holds the room it is currently in (or the container it is in, or the player if it's in the inventory)

The following are equivalent:

  • object.parent = room - slightly more efficient
  • MoveObject (object, room) - the way the GUI does it, because it's more obvious what it does.

There's also MoveObjectHere (object), which is exactly the same as writing object.parent = game.pov.parent
And AddToInventory (object) is the same as object.parent = game.pov.


Thanks mrangel.

I had a feeling that moving an object between rooms was possible but didn't come across it in the help document.
So far the only thing missing that some adventure creators have is a delay command. such as 'delay 2' which pauses the game for 2 seconds. This would be useful for having a delay between messages so it seems to the player that things are happening in real time.
I know I should have a better understanding of what things like 'GUI' means. I looked it up and it is 'Graphical User Interface 'so I'm thinking you mean the interface that has boxes you can tick and pull down menus to select from.


There is a delay command:

msg ("This script runs first!")
SetTimeout (3) {
  msg ("This script runs last, about 3-4 seconds after the other two!")
}
msg ("This script runs second!")

Note that the delay isn't particularly reliable; it could be up to 1½ seconds late. Or more if the player is using the online player,. because this causes a delay on the server side, and doesn't account for any lag or latency between the player and the server.

Also note that any code after the SetTimeout won't wait for it. It's better to think of SetTimeout as meaning "Make a note of a script to run after 3 seconds" - as soon as the note has been made, the script continues with the next command. Also, the script on that note is a separate script, so it doesn't have access to any variables from the script that created it.


Thanks. Good to know that a delay is possible mrangel.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums