Putting a room in the player's inventory.

I'd like to put a room in the inventory and when you use the room you enter it. The room is a laptop. If you can explain this in the gui and not a custom script it would really help. I know how to add a script via the laptop's attributes, but I can't find a script that puts the player in a certain room.


Figured it out.


player.parent = kitchen
Or whatever the room name is. Bedroom. Tavern. Harry's Hat Shop.
Just in case someone else needs to know.😎


Io

Forgewright, I'm pretty sure that does the opposite; puts the player in a room.



but I can't find a script that puts the player in a certain room.


Just going by his post...


Io

Ah, missed that part.

Then yes, that'd work. I think there's also a specific 'Move OBJECT to ROOM' block.


containment (parent-child) heirarchy is controlled by the built-in 'parent' Object (reference/pointer) Attribute

player.parent = room // putting the default 'player' Player Object into the default 'room' Room Object

room.parent = player // putting the 'default 'room' Room Object into the default 'player' Player Object (which is also known as the 'inventory'), though this will probably cause an error, but you get the idea, hopefully of using the built-in 'parent' Object (pointer/reference) Attribute

a slightly more fancy use of the 'parent' Object Attribute, an example of code to make an 'npc' Object follow the 'player' Object:

npc.parent = player.parent

// example of it:
player.parent = room // the 'player' starts in 'room'
npc.parent = room2 // the 'npc' starts in 'room2'

player.parent = room3 // the 'player' moves to 'room3'
// npc.parent = player.parent
// npc.parent = [player.parent = room3]
// npc.parent = [room3]
// npc.parent = room3 // the 'npc' has "followed" the 'player' to 'room3'

player.parent = room99 // the 'player' moves to 'room99'
// npc.parent = player.parent
// npc.parent = [player.parent = room99]
// npc.parent = [room99]
// npc.parent = room99 // the 'npc' has "followed" the 'player' to 'room99'


there's also the 'MoveObject(X,X)' helper Function/Script for doing the same thing:

MoveObject (MOVING_OBJECT, DESTINATION_OBJECT)

player.parent = room
// is the same as:
MoveObject (player, room)

room.parent = player
// is the same as:
MoveObject (room, player)

npc.parent = player.parent
// is the same as:
MoveObject (npc, player.parent)


directly in code (the 'asl/xml' code), you can nest Objects and/or use the 'parent' Object Attribute, they're the same thing:

<object name="room">

  <object name="player">
  </object>

</object>

// -----------------------------

<object name="room">
</object>

<object name="player">

  <attr name="parent" type="object">room</attr>

</object>

the concept of containment (parent/child) heirarchy:

grandfather
-> father
->-> son
->->-> grandson

grandfather is known as the 'root' (main/top) parent

grandfather is the direct parent of father
grandfather is the indirect parent of son and grandson

father is the direct child of grandfather
father is the direct parent of son
father is the indirect parent of grandson

son is the indirect child of grandfather
son is the direct child of father
son is the direct parent of grandson

grandson is the indirect child of grandfather and father
grandson is the direct child of son


we can manipulate (change/alter/re-arrange) the heirarchy, an example only:

father
-> son
->-> grandfather
->->-> great grandfather
-> grandson
granddaughter
-> mother
->-> grandmother
->->-> daughter


a computer's folder system is the best/direct example of containment (parent-child) heirarchy:

C: // (drive)
-> Program Files (x86: 32 bit) // (folder)
->-> Quest 5 // (folder)
->->-> Quest.exe // (program)


with quest, everything must be a child or indirect child of (contained within) the 'asl' GAME OBJECT (the 'asl' GAME OBJECT must be the root parent):

<asl version="550">

  <!--
  MASS OF YOUR ENTIRE GAME CODE/CONTENT
  -->

</asl>

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

Support

Forums