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 ➜ Another Regexp that is killing me.

Another Regexp that is killing me.

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


Posted by Halig   Portugal  (123 posts)  Bio
Date Fri 01 Jan 2016 07:51 PM (UTC)

Amended on Sat 02 Jan 2016 01:36 AM (UTC) by Nick Gammon

Message
Hi people.
I had the Health Bar working, but i mess it up when i start playing with the prompt and now i can't remember the regexp that i had. Been trying alot but can't manage to get it working.

My prompt:

<%h/%H {b%m/%M{x {g%v/%V{x %B %e {r>{x

Wich returns:

<2717/2717 982/982 1037/1037 E >

Now, i've been trying to set the trigger for the Health Bar plugin.


<triggers>
  <trigger
   enabled="y"
   match="^\<(\d+)\/(\d+)(\s*)(\d+)\/(\d+)(\s*)(\d+)\/(\d+)$"
   regexp="y"
   script="do_prompt"
   sequence="100"
  >
  </trigger>
</triggers>


Then we have the part of the wildcards:


function do_prompt (name, line, wildcards)

  hp, max_hp = tonumber (wildcards [2]), tonumber (wildcards [3])
  mana, max_mana = tonumber (wildcards [5]), tonumber (wildcards [6])
  move, max_move = tonumber (wildcards [8]), tonumber (wildcards [9])


I know that the problem is in the regexp, but i can't figure out where.

[EDIT] Changed [\code] to [/code].
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 02 Jan 2016 01:38 AM (UTC)
Message
Try getting rid of the final "$" because you have more on the line (the "E >" in this case).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Halig   Portugal  (123 posts)  Bio
Date Reply #2 on Sat 02 Jan 2016 11:36 AM (UTC)
Message
Hello Nick. Thank you, i had to change more things, but the $ at the end was the cause of it not working.
Thank you again.
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.


10,415 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.