|
Eyeless Wanderer
Joined: 02 Dec 2001 Posts: 80 Location: Canada
|
Posted: Tue Oct 11, 2005 12:34 am
%pos not working right (it seems) |
#TRIGGER {In the duffel bag you see (*).} {
#IF %pos( scroll, %1) {#VAR scrolllocation bag} {#VAR scrolllocation backpack}
#SHOW %pos( scroll, %1)
}
In the duffel bag you see a grey skinning knife, an inscribed snakeskin scroll, an Immortal Botolf card, a small clear topaz, a Famous Faces Ragge card, a sturdy ironwood caddy, an inscribed Coyote scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed Raven scroll, an inscribed Magpie scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed Wolverine scroll, an inscribed Wolf scroll and an inscribed Ram scroll.
0
In the duffel bag you see an inscribed snakeskin scroll, a grey skinning knife, an Immortal Botolf card, a small clear topaz, a Famous Faces Ragge card, a sturdy ironwood caddy, an inscribed Coyote scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed Raven scroll, an inscribed Magpie scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed Wolverine scroll, an inscribed Wolf scroll and an inscribed Ram scroll.
24
The only way to get this trigger to 'semi' work right, is to have a scroll as the first item in the bag... no good to me. What am I doing wrong? |
|
|
|
OmegaDeus Apprentice
Joined: 14 Sep 2005 Posts: 121
|
Posted: Tue Oct 11, 2005 1:12 am |
Quote: |
pos
Syntax: %pos(p,s)
return the position of pattern p in string s. Return 0/false if not found
Examples:
#SHOW %pos(ABC,12AB56ABC10ABC)
displays: 7
|
I'm not sure, but maybe %ismember would help with the if statement, but i'm just learning myself |
|
_________________
Look at me I've got zSKILLS |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Oct 11, 2005 1:22 am |
This is an issue with not properly surrounding your variables with quotes. ZMud functions separate parameters by commas, so your %pos() function after the %1 early expansion goes into effect looks like this:
%pos(scroll, a grey skinning knife, an inscribed snakeskin scroll, an Immortal Botolf card, a small clear topaz, a Famous Faces Ragge card, a sturdy ironwood caddy, an inscribed Coyote scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed Raven scroll, an inscribed Magpie scroll, an inscribed snakeskin scroll, an inscribed snakeskin scroll, an inscribed Wolverine scroll, an inscribed Wolf scroll and an inscribed Ram scroll)
Functions and commands will take what is needed and ignore the rest, so really what your %pos() function ends up being is this:
%pos(scroll, a grey skinning knife)
Obviously, that will return a 0.
What you need to do is surround %1 in quotes, like so:
%pos(scroll, "%1")
This tells ZMud that everything between the quotes is considered as one parameter, and will be correctly passed to the function or command. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Eyeless Wanderer
Joined: 02 Dec 2001 Posts: 80 Location: Canada
|
Posted: Tue Oct 11, 2005 2:29 am |
Perfect thanks, I knew it was me... I was trying the quotes in the wrong place... Everywhere but around the %1
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|