[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?
(New message)
Subject: Prompting my current EXP to the infobar
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date 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

Posted by Kaimarae   (34 posts)  [Biography] bio
Date 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,229 posts)  [Biography] bio
Date 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 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,229 posts)  [Biography] bio
Date 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 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,229 posts)  [Biography] bio
Date 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 Mon 16 May 2011 10:32 AM (UTC)  quote  ]

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

Message
I think I've narrowed it down. Everything is working hunkey-dorey... EXCEPT the experience catching line isn't triggering (according to trace). Disabled trigger "*" to see if it was overriding, it isn't. Which meeeans my trigger is probably wrong. This is the line:

You are level 25 (Significant) and 34.46% of the way to the next level.


I'm trying to match with this:

^You are level * and *% of the way to the next level.$


I have also tried with:

^You are level * \(*\) and *\% of the way to the next level\.$


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

EDIT: Jeeeesus. Just copy/pasted the line exactly and it still isn't matching. :|
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Mon 16 May 2011 10:24 AM (UTC)  quote  ]

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

Message
Mind pasting the whole set of triggers, and an example SCORE output (plus prompt)?

[EDIT]: I also find it useful to stick to lowercase letters with underscores to avoid any accidents. :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

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

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

Message
In other news, I can't edit any of those triggers now... Just says:

Quote:
The trigger named "expgrab2" has already been modified by a script subroutine.


... The hell?

I wonder if the difference between "expgrab2" (what it's being called) and "EXPgrab2" (what it IS called) makes any difference...

EDIT: It uh... Stopped doing that. Nevermind. :/
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Mon 16 May 2011 10:16 AM (UTC)  quote  ]
Message
Well, I found two things going wrong there...

Trigger #2 wasn't being enabled (duhhh... God) and it was trying to update CurrentEXP with "%3"... notice there are only two wildcards in my match line... Haha, fixed that, but it's still not happening... Hrm.
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Mon 16 May 2011 10:10 AM (UTC)  quote  ]
Message
Well, one's enabled by default and the other isn't. I think both should likely be disabled by default, and make sure you're enabling them both when the start trigger fires.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Mon 16 May 2011 10:03 AM (UTC)  quote  ]
Message
I went looking and found SendNoEcho myself actually. But the changing the end-trigger to the prompt I didn't think of. That works beautifully now.

This is what I tried:

Grab exp:
<triggers>
  <trigger
   group="Prompting"
   keep_evaluating="y"
   match="^You are level * and *% of the way to the next level\."
   name="EXPgrab2"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="99"
  >
  <send>SetVariable("CurrentEXP", "%3")</send>
  </trigger>
</triggers>


Omit all else:
<triggers>
  <trigger
   enabled="y"
   group="Prompting"
   keep_evaluating="y"
   match="*"
   name="EXPgrab3"
   omit_from_output="y"
   send_to="12"
   sequence="100"
  >
  </trigger>
</triggers>


I tried different combinations of 99 and 100.

[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Mon 16 May 2011 09:43 AM (UTC)  quote  ]
Message
Kaimarae said:
How do I set the priority? I thought it was Sequence... But that was mistaken. I think. Didn't work anyway.

A lower sequence actually means a higher priority, so a trigger with sequence 99 will always be processed before a trigger with sequence 100. Can you paste what you tried?
Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Kaimarae said:
Is it possible to hide the echo

Yes, use SendNoEcho(). (This doesn't apply if it's the MUD that's sending the echo.)

Kaimarae said:
and therefore the extra line of prompt?

Do you mean the prompt that comes after the SCORE output? If you change your "end" trigger to the prompt instead of the final line of the SCORE, you'll gag the prompt as well.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Mon 16 May 2011 09:38 AM (UTC)  quote  ]
Message
That's pretty cool. Two things:

How do I set the priority? I thought it was Sequence... But that was mistaken. I think. Didn't work anyway.

It's all triggering and enabling/disabling just fine, but because I still want to check score, I made a trigger on "You have slain *" which enables the start trigger and does Send("SCORE"). Is it possible to hide the echo and therefore the extra line of prompt? Is a minor quibble.

Thanks lots :]
[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.


3,498 views.

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

[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

[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]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]