Put X in Y

Cyllya
02 Dec 2015, 06:41
How do you set a script for this action with a particular combination of objects? I tried adding it to a verb of Y, but Quest says it conflicts with the existing command "put" and to use the Container tab to configure container behavior. Well, the container tab only has a spot to put scripts for opening, closing, locking, and unlocking.

Using the offline interface.

Thanks.

The Pixie
02 Dec 2015, 08:01
I would use a change script. It is pretty advanced Quest, but the implementation is actually simple. Go to the attributes tab of the object that is going inside the container. In the lower box, look for an attribute called "changedparent" (it will be in grey; click on "Name" to arrange them alphabetically to find it).

Click on it, so the script appears below, and then click on "Make Editable Copy", and then click on the Code view icon, to the right of that. You should see this:
if (game.pov = this) {
if (IsDefined("oldvalue")) {
OnEnterRoom (oldvalue)
}
else {
OnEnterRoom (null)
}
if (game.gridmap) {
MergePOVCoordinates
}
}

Delete all that (it is only used if the player becomes this object), and replace with this:
if (this.parent = mycontainer) {
msg("The object is now in the container.")
}

You will need to change "mycontainer" to the name of your container. Then start the game and see what happens. Hopefully you will see the message when that one object goes into that one container. Once you are happy it is working, change the message part to do whatever you want.

The Pixie
03 Dec 2015, 08:49
Oops, wrong thread.

Cyllya
05 Dec 2015, 15:58
Thanks, it worked!

It still says "Done" afterward, which is kind of weird, but that's not a big deal.