[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  tricky trigger help

tricky trigger help

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  

Posted by Jakevanderpuy   (22 posts)  [Biography] bio
Date Mon 27 Sep 2004 12:34 AM (UTC)

Amended on Mon 27 Sep 2004 12:44 AM (UTC) by Jakevanderpuy

Message
I'm trying to match on the following:
(A|An) @target (male|female) <wildcard2> in from the <wildcard3>.


My problem is that I don't know how to only partially match my target in this trigger. For example, let's say that the variable @target is currently set to "snow". I'd like to have the trigger match on "snow-pelted" as well.

Furthermore, I'd like this trigger to send "follow snow" to the world, and "o all bash snow" to the command line, and also highlight the text of the line on which the match was found.

Thus, if the world gives me:
A snow-pelted male centaur walks in from the east.

Then the client does the following:
Highlight line on which trigger matches. Send "follow @target" to world. Send "o all bash @target" to the command line.

Here's what I have so far:
<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="(A|An) @target (male|female) (.*) in from the (.*). "
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>
   send "follow @target"
   wildcard 4 = %4
   wildcard 5 = %5
  </send>
  </trigger>
</triggers>

[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Mon 27 Sep 2004 04:48 AM (UTC)
Message
^(a|an) @target(.*) (male|female) (.*) in from the (.*)\.$
should work.
make sure you ignore case (itll be a lot less problematic in the long run). Also make sure expand variables are checked. (and change your color to whatever)
then you send to script:
send "follow @target"
setcommand "o all bash @target"

And that should do you.
Hardest part is tweaking the trigger to deal with all the little quirks of regexp.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Jakevanderpuy   (22 posts)  [Biography] bio
Date Reply #2 on Mon 27 Sep 2004 12:13 PM (UTC)
Message
That works really good, but is it possible to send a command to the world as well as to the command line?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #3 on Mon 27 Sep 2004 03:20 PM (UTC)
Message
Send box:
send "follow @target"
setcommand "o all bash @target"

First line sends to world, second line sends to command.

Make sure you have "sendto:script" set.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Jakevanderpuy   (22 posts)  [Biography] bio
Date Reply #4 on Wed 29 Sep 2004 11:57 PM (UTC)

Amended on Wed 29 Sep 2004 11:58 PM (UTC) by Jakevanderpuy

Message
I find that I might have spoke too soon...my testing wasn't live and I still can't make it match on that reg exp, actually.

Been looking over the basic regular expression syntax and I can't find anything that'll do it, either. I think that it's going to require parsing the third wildcard (the adjective) for the @target variable, but I'm not entirely sure if that's what needs to be done, or even where to begin.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Thu 30 Sep 2004 01:06 AM (UTC)
Message
Post some examples of the match text.

Obviously your trigger is the problem, or one of them. So, lets see some examples.

Also, check for whitespace before or after the lines, as that can throw off your triggers.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Jakevanderpuy   (22 posts)  [Biography] bio
Date Reply #6 on Thu 30 Sep 2004 01:40 AM (UTC)

Amended on Thu 30 Sep 2004 01:50 AM (UTC) by Jakevanderpuy

Message

[HP: 74%] [ME:100%] [PE:100%] [zero] 
>>
A snow-pelted male centaur flies west.
[HP: 74%] [ME:100%] [PE:100%] [zero] 
>>
A snow-pelted male centaur flies in from the west.
[HP: 74%] [ME:100%] [PE:100%] [zero] 
>>
Suddenly a snow-pelted male centaur stabs you in the back!  
That really did HURT!
You dodge a snow-pelted male centaur's attack.
[HP: 53%] [ME:100%] [PE:100%] [zero]


It looks like my prompt display is refreshed as things occur. The >> is the input line where I input commands. Perhaps this means that the trigger will have to be a multiline? I'm trying to match on the "A snow-pelted male centaur flies in from the west." line.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #7 on Thu 30 Sep 2004 06:22 AM (UTC)

Amended on Thu 30 Sep 2004 06:25 AM (UTC) by Flannel

Message
Can you copy/paste the trigger you're currently using?

But no, you shouldnt have to do a multiline thing.

How about a few examples of whatever coming in? The thing you pasted was only one, so we could make a trigger that works for that one, but it might not work for anything else.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Jakevanderpuy   (22 posts)  [Biography] bio
Date Reply #8 on Thu 30 Sep 2004 08:35 PM (UTC)

Amended on Fri 01 Oct 2004 04:23 AM (UTC) by Jakevanderpuy

Message

 >>sta
You stop resting, and stand up.

[HP:100%] [ME: 21%] [PE:100%] zero
 >>
A thin male deep-elf walks west.
A white-haired female deep-elf walks west.
You hear foot steps nearby.

[HP:100%] [ME: 21%] [PE:100%] zero
 >>l thi
You do not see that here.

[HP:100%] [ME: 21%] [PE:100%] zero
 >>
A thin male deep-elf walks in from the west.
A white-haired female deep-elf walks in from the west.

[HP:100%] [ME: 21%] [PE:100%] zero
 >>nw
nw

------2nd Example-------

(HP: 75) (ME: 100) (PE: 9 (5 gold, 3 silver, 6 copper) (The Upper Landing) 
> 
A burly male centaur soars in from below. 
A prude female elf soars in from below. 
Gervais soars in from below. 
The giant dragonfly soars in from below. 
Baltus soars in from below. 

(HP: 75) (ME: 100) (PE: 9 (5 gold, 3 silver, 6 copper) (The Upper Landing) 
> 
Xinyz soars in from the east. 
A farmer soars in from the east. 
A soft-spoken shaman soars in from the east. 
A boulder bear soars in from the east. 

(HP: 75) (ME: 100) (PE: 9 (5 gold, 3 silver, 6 copper) (The Upper Landing) 
> 


I'm just using the regular expression trigger that you posted.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Tue 05 Oct 2004 02:11 AM (UTC)
Message
You haven't done what Flannel requested. In the trigger list, select the relevant trigger, click the Copy button, and paste the resulting trigger here.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #10 on Tue 05 Oct 2004 04:41 AM (UTC)
Message
What would you set to match on, on each of those? (what would you target?)

Theres a few types of displays, even in your first example:
A thin male deep-elf walks west.
A white-haired female deep-elf walks west.

See how male is before, and female is after? Thats why the trigger I originally gave didnt work (but it would indeed work for the one example you gave)

So, youll need more than one trigger, or one trigger with multiple versions of match text.

And You dont need to show us anything except the messages about them coming in, for future reference.

But we can do that (the multiple versions) we're just going to need to know what you WANT to match with (whats in your target variable).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Jakevanderpuy   (22 posts)  [Biography] bio
Date Reply #11 on Tue 05 Oct 2004 05:46 PM (UTC)

Amended on Tue 05 Oct 2004 05:57 PM (UTC) by Jakevanderpuy

Message
<triggers>
<trigger
enabled="y"
ignore_case="y"
keep_evaluating="y"
match=" ^(A|An) @target(.*) (male|female) (.*) in from the (.*)\.$ "
regexp="y"
sequence="100"
>
<send>send &quot;follow @target&quot;
setcommand &quot;o all bash @target&quot;</send>
</trigger>
</triggers>



My target in this example is 'poor' without quotes.
>>
Target: poor
c 'magic missile' s poor
You start to concentrate.
[HP: 97%] [ME: 95%] [PE:100%] zero
>>
You utter the words, 'waouq wuggurz'.
You watch with pride as a flurry of magic missiles hits a poorly-dressed male human!
[HP: 97%] [ME: 95%] [PE:100%] zero
>>
A poorly-dressed male human walks in from the south.
A poorly-dressed male human misses an Uxmaln pack mule.
[HP: 97%] [ME: 95%] [PE:100%] zero
>>
A poorly-dressed male human's punch at an Uxmaln pack mule's left arm is deflected by fur hide.
[HP: 97%] [ME: 95%] [PE:100%] zero
>>

Still won't match on that.
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #12 on Tue 05 Oct 2004 07:20 PM (UTC)
Message
Somehow, I doubt very highly if poorly-dressed is a valid server side keyword for that mob. Regardless of what you attempt to do thru scripting, you are still bound by whatever keywords are assigned to a mob for targeting.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Jakevanderpuy   (22 posts)  [Biography] bio
Date Reply #13 on Tue 05 Oct 2004 09:33 PM (UTC)
Message
Actually, poorly-dressed is a valid server-side keyword, but that's besides the point. I just can't match or partially match on the message the mud sends me when someone walks into the room I'm in.
[Go to top] top

Posted by Assassin   (73 posts)  [Biography] bio
Date Reply #14 on Tue 05 Oct 2004 11:05 PM (UTC)
Message
You might have to try and avoid the prompt's like i did in my mud.

My mud has *> and wouldnt fire unless i changed my
trigger to (?:\*\>)?trigger....




[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


43,324 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]