Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Matching of Prompt

Matching of Prompt

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


Posted by Lethethar   (7 posts)  Bio
Date Wed 16 Jul 2014 07:11 PM (UTC)
Message
I am trying to match all the varieties of my prompts
I have my prompt matched when out of combat but the second I end up in combat I cannot seem to make it match. <triggers>
<trigger
clipboard_arg="5"
enabled="y"
match="^(\d+)H (\d+)V (\d+)X (\d+)C Exits\:[NWSEUD]+\&gt;$"
regexp="y"
send_to="12"
sequence="100"
>
<send></send>
</trigger>
</triggers>
This works and matches the prompt but when I go into combat my prompt looks like

115H 94V 26542X 6C [Sel:Perfect] [the small black spider:Good] Exits:EW> 

<triggers>
<trigger
enabled="y"
match="^(\d+)H (\d+)V (\d+)X (\d+)C [\w\:[A-Za-z .]+] [(\w +)\:[A-Za-z .]+]Exits\:[NESWUD]+\&gt;$"
match_text_colour="y"
regexp="y"
send_to="12"
sequence="100"
text_colour="8"
>
<send></send>
</trigger>
</triggers>
but this trigger does not match. does not fire ver 4.84
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #1 on Wed 16 Jul 2014 07:37 PM (UTC)

Amended on Wed 16 Jul 2014 07:41 PM (UTC) by Fiendish

Message
FYI: the forum is eating some of your slashes. \[ and \] should be entered as \\[ \\] when you post here. MUSHclient has a feature that makes whatever is in your OS Clipboard forum-safe.

The simple explanation is that (and of course you know this already) your regex is wrong.

I have more luck with

^(\d+)H (\d+)V (\d+)X (\d+)C \[\w+\:[A-Za-z .]+\] \[([\w ]+)\:[A-Za-z .]+\] Exits\:[NESWUD]+\&gt;$


For future regex help, you should try one of the handy online assistants like http://www.regexr.com/

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Lethethar   (7 posts)  Bio
Date Reply #2 on Wed 16 Jul 2014 08:21 PM (UTC)
Message
Thank you for the help had been going over it for several hours.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 16 Jul 2014 09:17 PM (UTC)
Message
There is a helper menu inside the trigger edit window:



That can help choose appropriate elements.

Also:

Template:regexp Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


13,895 views.

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

Go to topic:           Search the forum


[Go to top] top

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