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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Prompting my current EXP to the infobar
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Prompting my current EXP to the infobar

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2 

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #15 on Mon 16 May 2011 10:39 AM (UTC)  quote  ]

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
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #16 on Mon 16 May 2011 10:49 AM (UTC)  quote  ]

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 ;)
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #17 on Mon 16 May 2011 10:53 AM (UTC)  quote  ]
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
[Go to top] top

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

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #19 on Mon 16 May 2011 07:19 PM (UTC)  quote  ]
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
[Go to top] top

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

/bow
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #21 on Tue 17 May 2011 12:36 AM (UTC)  quote  ]
Message
Glad to help!

'Soludra' on Achaea

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


6,748 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [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.

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]