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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Reg Exp Help

Reg Exp Help

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


Posted by Webkid   USA  (22 posts)  [Biography] bio
Date Sun 31 Jul 2005 04:04 AM (UTC)
Message
Much thanks to whoever can help me with this.

I can't for the life of me get these to match correctly.
I have two triggers, simular but different.

The syntax is as follows:

You slice <mob name> with your <weapon name>.

and

You slice <mob name> horribly with your <weapon name>.

I have tried everything I can think of to get these to match properly, but everything I have tried hasn't worked corretly.

Any ideas?

-Webkid
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Sun 31 Jul 2005 07:02 AM (UTC)
Message
What have you tried?
Do you need to 'know' the modname (as in, be able to use it in a wildcard).
If not, then you can just do this:
^You slice (.*?) with your (.*?)\.$
However, the first wildcard would be either "mob name" or "mob name horribly" depending.

You can also do this:
^You slice (.*?)(?: horribly) with your (.*?)\.$
which will allow you to use %1 as "mob name" and %2 as "weapon" all of the time, regardless of horribly.
However, in the past we've had some problems with lookaheads having wierd results, so if that doesnt work, you have two options.

If you want to make sure you can use the wildcards, thn you'll need to do this:
^You slice (.*?)(| horribly) with your (.*?)\.$
which will allow you to use %1 and %3 as your mob, and weapon respectively (and 2 will be "" or " horribly", however, if you DONT care about using the wildcards (or at least the weapon), you can do this:
^You slive (.*?)( horribly)? with your (.*?)\.$
which will make it so you either have %1 %2 or %1 %2 %3, with the first being the mob name, the last being the weapon, and the middle (where applicable) being " horribly".

Other problems, make sure there isnt a space after the period, or at the beginning of the line (or a prompt at the beginning of a line), and make sure you have regexp checked (and either double check you have the correct case of everything, or tell mushclient to ignore it). Also, if you are testing it using CTRL-SHIFT-F12, make sure you put a carriage return before and after the line, to make sure you're sending a clean line, and ending with a newline (the trigger won't try to match until it recieves a newline).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Webkid   USA  (22 posts)  [Biography] bio
Date Reply #2 on Sun 31 Jul 2005 09:12 PM (UTC)
Message
I'm sorry, I'm trying to learn how to use these Reg Exps so thanks for bearing with me.

Here is what I'm getting, first the message, then the output:

You slice <mob> with your <weapon>. <-- Message to match.
DEBUG: You slice <mob> for -20 to -23 hps. <-- Correct output message.
You slice <mob> horribly for -24 to -27 hps. <--- Shouldn't show up.


You slice <mob> horribly with your <mob>. <-- Message to match.
DEBUG: You slice <mob> horribly for -20 to -23 hps. <--- Shouldn't show up.
You slice <mob> horribly for -24 to -27 hps. <-- Correct output message.


<triggers>
  <trigger
   custom_colour="7"
   enabled="y"
   keep_evaluating="y"
   match="You slice (.*) with your (.*)\."
   regexp="y"
   repeat="y"
   send_to="2"
   sequence="100"
  >
  <send>DEBUG: You slice %1 for -20 to -23 hps.</send>
  </trigger>
  <trigger
   custom_colour="6"
   enabled="y"
   keep_evaluating="y"
   match="You slice (.*?)(| horribly) with your (.*)\."
   regexp="y"
   repeat="y"
   send_to="2"
   sequence="100"
  >
  <send>You slice %1 horribly for -24 to -27 hps.</send>
  </trigger>
</triggers>

-Webkid
[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.


11,509 views.

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]