[Gruescript] Test whether an object is out of play

Is it possible in Gruescript to test whether an object is out of play?

In the documentation “hide thing” is used to “set a thing’s ‘location’ to nothing, so that it is
effectively removed from the game”, but is it then possible to test whether an object’s location is nothing?

In my game, I’ve tried

thingat bunny nothing

and

thingat bunny 0

but neither is accepted.

I think a thing is out of play when its loc is 0 and it is not carried.

According to a short test in the cloak of darkness example, this seems to work:

hide cloak
# ...
eq cloak.loc 0
!carried cloak
say Cloak is out of play.

(Carried things also seem to have loc 0, therefore we need to test that something is not carried to see whether it’s really out of play.)

1 Like

This worked! Thank you.

1 Like