Is there a command or a line of code to make an item droppable/undroppable while in-game?

Red Knight
23 Jan 2019, 00:48

I know there is a line of code to make objects removable while in-game. That command looks something like this:

clothes.removeable = true
SetVerbs

Is there a similar command to make an object openable/closable and droppable/undroppable while in-game? Note that I do not wish to tick it in the inventory and container tab. I need the command line.

Thanks in advance to anyone who can help me with this.


Io
23 Jan 2019, 02:09

There's several ways to do this. One way is to give the object the CanBeDropped attribute as a Boolean (True/False). Then, when you drop it, you Run a Script instead of doing the default drop behavior. A possible example, and pardon my psuedocode:

if WhateverObject.CanBeDropped=True:
         move WhateverObject to expression:Player.parent
else:
      //Nothing happens

But wait! You don't have to make any Attribute. It turns out, there are already these attributes preprogrammed with Quest! For example, 'Can I drop this?' relates to the attribute WhateverObject.drop being True or False. So you can just:

set WhateverObject.drop=False

There's a bunch of different attributes for these things. Open/Closeable, as far as I can tell, is linked to WhateverObject.open and WhateverObject.close respectively.


hegemonkhan
23 Jan 2019, 05:58

as already said by 'Io' in his/her post:

http://docs.textadventures.co.uk/quest/attributes/drop.html

OBJECT.drop = false
OBJECT.drop = true

all of the built-in Attributes for Objects:

http://docs.textadventures.co.uk/quest/elements/object.html


mrangel
23 Jan 2019, 12:46

Also worth nothing that for the drop attribute, instead of setting it to true or false you can make it a string (which is displayed instead of the standard drop message), or a script attribute (which is run when the player tries to drop the object)