Trying to use the hasnotmoved attribute

Brian5757
25 Feb 2020, 01:30

In the games room there is an in-room description for the toy bear "A toy bear is in the corner". If I pick up the bear and drop it in the current room or another room then I don't want the same in-room description.

I tried this:
{if not (Toy Bear.hasbeenmoved:A Big Toy Bear is in the corner}

After the bear has been picked up and dropped I still get the same in-room description that the bear is in the corner
and I get "you can see a toy bear" after I have dropped a bear (with the Scenery box ticked for the bear). This could be due to no in-room description replacement text if the hasbeenmoved condition passes.
I could write script to be activated when the bear is picked up but I don't know if/how you change the in-room description in the script.


mrangel
25 Feb 2020, 02:20

{if not (Toy Bear.hasbeenmoved:A Big Toy Bear is in the corner}

I think you've got an extra bracket there. If there isn't an object named (Toy Bear, then {if treats all of its attributes as false.

and I get "you can see a toy bear" after I have dropped a bear (with the Scenery box ticked for the bear)

The "take" command removes the scenery flag from objects that are taken.

You probably want to give it a "when dropped" script, something like:

this.parent = destination
this.scenery = true

or add this.scenery = true to its changedparent script attribute.


Brian5757
25 Feb 2020, 02:56

Hi arangel.

I get this error:
Error running script: Error compiling expression 'destination': Unknown object or variable 'destination'
when adding:
this.parent = destination
this.scenery = true

However if I just use "this.scenery = true" I have no problems
So I'm wondering "if this.parent = destination" is needed


mrangel
25 Feb 2020, 08:52

Ah, my mistake.

In the drop script, setting the destination is necessary. In the ondrop script (which I'd forgotten about), it is done for you.

Note that if the player puts the bear in a container, the "drop" script is run but not the "ondrop"; so it will still be scenery (this might be the behaviour you want; if not, you'd probably have to use either the "drop" or "changedparent" scripts - and maybe use those scripts to change the in-room description as well)