Essentially the question is this: Is there a difference between "mposet on $n $o..." and "mposet on $n iVNUM...", and if so, how/when are they used?
I'm looking over a particular object that's coded to take into account whether it's being held before it tries to change its state. "mposet $o..." works fine when the object is on the ground, but "mposet on $n $o..." seems not to work when it is in inventory. Should the vnum be used instead of $o in the latter case, or should the user be told to hold the object before any fields can be changed?
Thanks! Hope that wasn't too confounding.
MPOSET Syntaxes
MPOSET Syntaxes
Nascentes morimur, finisque ab origine pendet.
Re: MPOSET Syntaxes
mposet on $n $o should be the right way if the program is on the object itself. If the program is somewhere else (on a mobile, for example), then it should be mposet on $n i1234.
Post your code here and we can look at it?
Post your code here and we can look at it?
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Re: MPOSET Syntaxes
That's what I thought. So $o should be the right target, since the prog is on the object itself.
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?
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
~
|
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.
Re: MPOSET Syntaxes
You could have it check if it is worn and, if not, if it is in the inventory or on the ground. Or you could, yes, just check if it's in hand or on the ground. Depending on the object in question you could also consider an owner's mark to differentiate.
You had a typo with value5 in the second part of the second if check.
I would associate echoes with each outcome because ostensibly the result would be different based upon the value of objval5.
You had a typo with value5 in the second part of the second if check.
I would associate echoes with each outcome because ostensibly the result would be different based upon the value of objval5.
Code: Select all
>intercept_prog toggle~
if actorhasobjnum(1234)
if objval5($o) == 0
mposet on $n $o value5 1
mpecho stuff
else
mposet on $n $o value5 0
mpecho stuff
endif
else
if objval5($o) == 0
mposet $o value5 1
mpecho stuff
else
mposet $o value5 0
mpecho stuff
endif
endif
~
|
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Re: MPOSET Syntaxes
Understood and noted. I had the check's meaning mixed up after all. Also hadn't caught that typo.
Thanks you much!
Thanks you much!
Nascentes morimur, finisque ab origine pendet.