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 ➜ Prompting my current EXP to the infobar

Prompting my current EXP to the infobar

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


Pages: 1  2 

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #15 on Mon 16 May 2011 10:39 AM (UTC)

Amended on Mon 16 May 2011 10:52 AM (UTC) by Twisol

Message
Kaimarae said:
^You are level * and *% of the way to the next level.$


Any idea what I'm doing wrong? (Regular Expression is checked)

Yeah, it's the mixture of basic patterns and regular expressions again. * alone is a basic pattern symbol for a match. In a regular expression it means something totally different ("zero or more of the character before this one").

^You are level \d+ \([^)]+\) and \d+(?:\.\d+)?% of the way to the next level\.$

Internally the basic-pattern * is converted to (.*?), but that's not always (read: rarely) optimal, so I took the liberty of making it match more exactly. \d means "a digit", and the + after it means "one or more". The bit after that matches anything in parentheses that isn't an end parenthesis, and then I match the experience (making the fractional part optional). I also escaped the .'s because . means "any character" in regexp.

You might want to check out a tutorial on regular expressions. They're pretty easy to understand once you've learned a bit of the syntax.

http://www.regular-expressions.info/tutorial.html

[EDIT]: Also, congratulations on levelling up since you started the thread. ;)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Kaimarae   (34 posts)  Bio
Date Reply #16 on Mon 16 May 2011 10:49 AM (UTC)

Amended on Mon 16 May 2011 10:51 AM (UTC) by Kaimarae

Message
Woowoo! Matches. Now, one last question... What %# do I use to capture the percentage? ^_^;

EDIT: Regarding the level, thanks! It was a by-product of bashing things trying to get the triggers to work ;)
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #17 on Mon 16 May 2011 10:53 AM (UTC)
Message
OOPS. I just edited my original post instead of quoting it! XD Luckily I could go back in my history and fish out the original... anyways, my response is below.

^You are level \d+ \([^)]+\) and (\d+(?:\.\d+)?)% of the way to the next level\.$


You can add parentheses around a piece of the expression to capture it. I bolded/underlined the changed part.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Kaimarae   (34 posts)  Bio
Date Reply #18 on Mon 16 May 2011 01:50 PM (UTC)
Message
So do I then use %1, or just Send To Variable? (Sorry if I'm a bit dense at times :P)
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #19 on Mon 16 May 2011 07:19 PM (UTC)
Message
"Send to" just tells MUSHclient what you want to do with the Send box. If it were set to "Variable", the contents of the Send box would be put in a variable. ;) You want Send to Script, using %1 in it for the capture.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Kaimarae   (34 posts)  Bio
Date Reply #20 on Tue 17 May 2011 12:19 AM (UTC)
Message
Yessss! Everything works beautifully. Thanks so much :D

/bow
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #21 on Tue 17 May 2011 12:36 AM (UTC)
Message
Glad to help!

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
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.


64,473 views.

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

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.