*SOLVED* Checking if an object is in the room with the player

fuzzybunny2203
11 May 2018, 06:23Okay, I know there are quite a few forum posts on this, but I still don’t quite get how!
I’m doing an “add to party” command- the pattern is “add #object# to party” and all the objects the player can add to their party, they have a special attribute which the command checks if the object has and then either tells the player they can’t add that object to their party, or adds it to player.followers. That’s all fine. I’m good with that.
My problem is I want it to be a bit harder for the player- the NPC they can add to the party has to be in the same room as the player for this command to work (cause irl it would be weird if you shouted to the sky “I summon ‘blah blah blahh’ and that person would teleport to you- cool)
Sorry if this is a stupid question I feel there’s a really obvious answer to this I’m missing >n<

fuzzybunny2203
11 May 2018, 06:30Okay lol nm I just realised that I could use verbs lol XD
hegemonkhan
11 May 2018, 06:51(filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)
containment heirarchy/structure is actually controlled by the built-in 'parent' Object Attribute:
http://textadventures.co.uk/forum/quest/topic/rkrk9-o7tuqslvur0wdtsq/idea-for-a-future-release-of-quest#b01a1a38-909c-472e-a588-696423402611
so, you can do this, an example:
create ("player")
create ("orc")
create ("room")
player.parent = room // the 'player' Player Object is contained within the 'room' Room Object
orc.parent = room // the 'orc' Object is contained within the 'room' Room Object
// both the 'player' and the 'orc' are in (contained within) the same room (the 'room' Room Object)
if (orc.parent = player.parent) { // if (ROOM_THAT_ORC_IS_IN = ROOM_THAT_PLAYER_IS_IN)
// blah scripting 1
} else { // if (NOT in the same room)
// blah scripting 2
}
// the 'blah scripting 1' is run/done/executed/fired/used
------------------
create ("room2")
orc.parent = room2
// now the 'orc' is in (contained within) the 'room2' Room Object, whereas the 'player' Player Object is still within the 'room' Room Object: aka, the 'player' and 'orc' are NOT in the same room
if (orc.parent = player.parent) { // if (ROOM_THAT_ORC_IS_IN = ROOM_THAT_PLAYER_IS_IN)
// blah scripting 1
} else { // if (NOT in the same room)
// blah scripting 2
}
// the 'blah scripting 2' is run/done/executed/fired/used