How to actually remove item from container?
Deadstar
29 Apr 2017, 06:54I asked this in an other thread, but because that was about a completely different subject, I started this thread.
I want something removed from a container. Say I have a matchbox, I open it and find a match inside. with Take match, i pick it out of the container and place it in my inventory.
But how can I make sure that the match is actually out of the box, so that when I open it another time it won't show the: there is a match inside, but rather: there is nothing inside
Hope someone can help me.

Father
29 Apr 2017, 07:15The container should state that it contains a match when examined . If the match is removed, then that message will disappear. The match will appear in your inventory. The program will handle all this automatically.
Deadstar
29 Apr 2017, 08:28Can you state this in the program itself, in the object options? Or do you have to code this yourself?
I can not find it
The Pixie
29 Apr 2017, 11:32The tutorial covers this:
http://docs.textadventures.co.uk/quest/tutorial/using_containers.html
Deadstar
29 Apr 2017, 12:19Thanks! Followed that one but did not work. Now I realize that I had also a print to show when it was opened. I forgot to remove that one, so that's why I thought it did not work because the print contained (almost) the same text :)
And I completely looked over 'List children when object is looked at or opened' That was what I needed
hegemonkhan
29 Apr 2017, 19:18containment/child-parent (think of folders on your computer) heirarchy:
grandfather
-> father
->-> son
->->-> grandson
root (main) parent: grandfather
grandfather's direct child: father
grandfather's indirect child: son and grandson
father's direct parent: grandfather
father's direct child: son
father's indirect child: grandson
son's indirect parent: grandfather
son's direct parent: father
son's direct child: grandson
grandson's indirect parent: grandfather and father
grandson's direct parent: son
HK
-> pants
->-> wallet
->->-> $1
->->-> $5
-> shirt
-> shoes
Joe
-> shorts
-> t-shirt
c:\ (drive)
-> Programs (Folder)
->-> Quest 5 (Folder)
->->-> quest's various sub folders (Folder)
->->->-> quet's various files (Files)
quest is containment/child-parent heirarchy:
the root (main) parent (container):
(this is your GAME OBJECT, your game, your game's content/code)
<asl version="550">
</asl>
everything must be inside (directly or indirectly) of the 'asl' code tag block:
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
</game>
<object name="example_object">
<object name="example_2_object">
</object>
</object>
<type name="example_type">
</type>
<verb name="example_verb">
</verb>
<command name="example_command">
</command>
<function name="example_command">
</function>
<turnscript name="example_turnscript">
</turnscript>
<timer name="example_timer">
</timer>
</asl>
every 'Object' Element (not sure about other Elements) directly inside of the root (main) parent (): has 'null' Value for it's built-in 'parent' Object Attribute (though the default is to not show the 'parent' Object Attribute when its Value is 'null' and/or via nesting an 'Object' Element within another 'Object' Element):
room.parent = null
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
</game>
<object name="room">
// not shown 'parent' Object Attribute (because it's Value is: null): room.parent = null
<object name="player">
// not shown 'parent' Object Attribute (because it's code-nested-directly into the 'room' Object): player.parent = room
</object>
</object>
</asl>
// --------------
this is the exact same containment heirarchy as above:
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
</game>
<object name="room">
// not shown 'parent' Object Attribute (because it's Value is: null): room.parent = null
<attr name="parent" type="object">null</attr>
</object>
<object name="player">
<attr name="parent" type="object">room</attr>
</object>
</asl>
so, you can see that the built-in 'parent' Object Attribute is what actually controls the containment heirarchy. The helper Function 'MoveObject (MOVING_OBJECT, DESTINATION_OBJECT)', is just doing this for you: MOVING_OBJECT.parent = DESTINATION_OBJECT
the 'RemoveObject (NAME_OF_OBJECT)' helper Function does this for you: NAME_OF_OBJECT.parent = null
also, there's this to understand as well:
(note that I'm just using the 'player' Object as an example, but do NOT set the 'player' Object's 'parent' to 'null', as this will cause an error, as quest engine/underlying-code requires that there is a designiated Player Object and that it is to be nested inside of a Room Object at all times)
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
</game>
<object name="room">
<object name="player">
</object>
</object>
</asl>
then if you do this in scripting: player.parent = null, or this: RemoveObject (player), it produces this effect (or effective new code):
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
</game>
<object name="room">
</object>
<object name="player">
</object>
</asl>
// -----------
and for this as well:
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
</game>
<object name="room">
</object>
<object name="player">
<attr name="parent" type="object">room</attr>
</object>
</asl>
then if you do this in scripting: player.parent = null, or this: RemoveObject (player), it produces this effect (or effective new code):
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="example_game">
</game>
<object name="room">
</object>
<object name="player">
<attr name="parent" type="object">null</attr>
</object>
</asl>
Deadstar
01 May 2017, 18:55Thank you hegemonkhan, I will dive into it