|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Tue Oct 30, 2012 1:47 am
trigger nightmare |
Hi,
I am trying to create a trigger that will look at the following text
Quote: |
You are in a secluded woodland grove, dominated by a large pool of glistening water. You feel magic all about you.
The grove has three possible exits: north, east and west.
A jealous satyr is lounging, two leprechauns are frolicking, a wounded wood nymph is cowering and a hobgoblin is lurking with malicious intent.
The corpse of a wood nymph is floating in the pool.
>greet satyr
You greet the jealous satyr.
The jealous satyr returns your greeting frostily.
|
I want a trigger to match "possible exits" then check for mob names against those contained in my @MOBLIST variable and their stance which is my @STANCE variable(lounging, frolicking etc) and load matching the mob names into a variable list and then greet them one at a time, waiting for them to return the greeting before starting the next one but i want it to not include the one from the following line as that line always only contains room items like corpses etc.
so far i have:
Quote: |
pattern: possible exit*
Value:
#cond {{A|An|Two| a |, a|, an|Three}* ({@MOBLIST}){ |,|s}* ({@STANCE})} {#forall %replace( %1, " ", "|") {#additem GREETLIST %i}{LoopLines|Param=1}}
|
Needless to say, this not only doesn't work but I've tried so many permutations that I might have nearly had it working at one point but killed it in subsequent revisions...I've become mentally numb and somewhat dismayed, I've read and re-read help files but alas I am beaten.
Any advice would be much appreciated.
Armyman. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4662 Location: Pensacola, FL, USA
|
Posted: Tue Oct 30, 2012 2:28 am |
i remember doing something similar... let me see
Why make it conditional? sure it errorproofs a bit, but given what you are checking against, it should not pop up too often.
better would be to turn a permanent trigger on and off
also, triggers are not case sensitive unless you check the box to make them so
#TRIG "greeter" {{a|an|the|two|three|four|five|six} ({@moblist}{s|es|}) {@stance}} {greet %word(%1, %numwords(%1))}
just make sure the repeat within line option is checked
this assumes that the entire short description "wounded wood nymph" and so on would be members of @moblist
then your possible exit line can: #T+ greeter
and make a prompt trigger to: #T- greeter |
|
_________________ Discord: Shalimarwildcat |
|
|
|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Tue Oct 30, 2012 1:23 pm |
thanks for the reply, a few questions though... will that only enter one greet at a time, waiting until the greet has been returned? also what would happen when it ran out of things to greet? also some stuff that appears on the second line has the same "stance" as stuff that can appear on the first line, would your trigger attempt to greet those things too?
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4662 Location: Pensacola, FL, USA
|
Posted: Tue Oct 30, 2012 1:32 pm |
it should fire one for every time the entire pattern was matched
assuming all the mobs in your first example are matching..
it would fire 4 times, even though there are 5 mobs
the leprechauns, looking the same in every way, would get greeted as a group.
when it runs out of things to greet, the next trigger with priority will fire, if it matches (essentially nothing) |
|
_________________ Discord: Shalimarwildcat |
|
|
|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Tue Oct 30, 2012 2:38 pm |
awesome, thanks, i'll give it a try in a bit and let you know how much i love you :)
|
|
|
|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Tue Oct 30, 2012 8:31 pm |
ok, just tried that and it didn't work, at all. Thanks for trying though :)
As a side note, i don't see any repeat within line option. |
|
|
|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Tue Oct 30, 2012 8:38 pm |
shalimar wrote: |
this assumes that the entire short description "wounded wood nymph" and so on would be members of @moblist
|
i just re-read your post and saw that, my moblist is just the name of the creature, not the type eg. happy, sad etc but i just added a wildcard between the amount of mobs and the @moblist
edit: still doesn't work |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4662 Location: Pensacola, FL, USA
|
Posted: Tue Oct 30, 2012 8:42 pm |
the problem with * is that it is greedy and will take as much text as possible... it might work, but you might get unexpected results as well.
When it failed for you, did it fail to greet everything, or anything? |
|
_________________ Discord: Shalimarwildcat |
|
|
|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Tue Oct 30, 2012 8:52 pm |
failed to greet anything at all
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4662 Location: Pensacola, FL, USA
|
Posted: Tue Oct 30, 2012 9:26 pm |
I see a potential problem... try this version
#TRIG "greeter" {{a|an|the|two|three|four|five|six}[%w%s]({@moblist}{s|es|}) {is|are} {@stance}} {greet %1}
I forget if zMUD allowed for there to be a null value in anonymous variables.. '{s|es|}' |
|
_________________ Discord: Shalimarwildcat |
|
|
|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Tue Oct 30, 2012 9:38 pm |
cool, will give that a try when i get a sec this evening, thanks for the hard work on my behalf :)
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Oct 30, 2012 9:54 pm |
Quote: |
the problem with * is that it is greedy and will take as much text as possible...
|
This is a common misunderstanding. In terms of functional implementation, * operates no more or less greedily than %w or %d. With the exception of %t (directions), %q/%y/$/^ (wildcards that match on nontext or unprintable concepts such as word boundary or the start/end of the line), &NN and ? (fixed-width wildcards) and stringlists (match one element from a list of possibilities), all zscript patternmatching symbology attempts to match to the widest-available text as possible.
The difference, which is what you were attempting to convey, is in what character set each wildcard is designed to match. * matches everything that can be visibly printed on the screen (letters, numbers, symbols, and whitespace), while stuff like %w, %d, and %s match only a single individual type (letters, numbers, and spaces, respectively) that is naturally limited in our textual syntax to a short token.
To avoid the abuse inherent in Shalimar's trigger, you were in fact close to the solution. You want to use a multistate trigger, but you don't put the #condition in the executable code of the obvious exits trigger. #CONDITION = #TRIGGER, with the added limitation that it cannot be a standalone setting:
#trigger {pattern} {code}
#condition {pattern} {code}
You would also want to anchor the line to further tighten up the match, since it's not likely for any game to give regular players the ability to mimic real lines on a real-format basis. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4662 Location: Pensacola, FL, USA
|
Posted: Tue Oct 30, 2012 10:29 pm |
Given that the trigger is only on between room exit and the next prompt, where is the abuse potential?
Anchoring it also means that it wont repeat for several matches on one line. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Oct 31, 2012 2:41 am |
Which doesn't exist in ZMud, by the way.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4662 Location: Pensacola, FL, USA
|
Posted: Wed Oct 31, 2012 5:24 am |
Well... that makes things more difficult, but not impossible.
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
armyman Newbie
Joined: 30 Oct 2012 Posts: 8
|
Posted: Thu Nov 01, 2012 8:14 pm |
sorry guys, haven't forgotten about this, family drama is keeping me away from everything, will try the suggested trigger asap
|
|
|
|
|
|