That's what I thought. So
$o should be the right target, since the prog is on the object itself.
Code: Select all
>intercept_prog toggle~
if wear_loc($o) != -1 ; $o is being worn/held in inv
if objval5($o) == 0 ; Toggle the value
mposet on $n $o value5 1
else
mposet on $n $o balue5 0
endif
mpecho stuff
else ; $o is on the ground
if objval5($o) == 0 ; Toggle the value
mposet $o value5 1
else
mposet $o value5 0
endif
mpecho stuff
endif
~
|
If object is in inventory or being held, then check value5 and set it with
mposet on $n $o...; otherwise, object must be on the ground, so check value5 and set it with
mposet $o....
But whenever the prog runs while the object is in the inventory, value5 seems not to change (as indicated by checks on value5 in another prog).
Edit: Aha--I'm dumb. The problem isn't with the mposet statements at all, is it? The primary check should be "if actorhasobjnum(iVNUM)", rather than "if wear_loc($o) != -1". The latter is true only when $o is
worn, so it fails to catch when the object is in inventory.
Do I have the right of it?
Nascentes morimur, finisque ab origine pendet.