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
➜ Triggering on my prompt line?
Triggering on my prompt line?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Kaimarae
(34 posts) Bio
|
Date
| Wed 11 May 2011 09:40 AM (UTC) |
Message
| Hello all,
This is my first post here, but I've been lurking for a while.
The issue I am having is that I'm trying to trigger on my prompt and display the relevant data on the info bar. I'm having no trouble displaying what I want, however the trigger on the prompt just Refuses to fire.
This is my prompt:
869h, 230e, 657m xb A:50% -
This is my trigger (I have tried SO many variations on this):
Any ideas on what I'm doing wrong?
I've turned on trace to make sure it wasn't just my script (Lua) failing to do anything. It doesn't trigger at all.
Any help would be greatly appreciated.
Regards,
Kaimarae | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Wed 11 May 2011 09:57 AM (UTC) Amended on Wed 11 May 2011 09:58 AM (UTC) by Twisol
|
Message
| Well, there are two possibilities here. The first is that your trigger is incorrect (and it is). Try this:
^(\d+)h, (\d+)m, x?b? A:(\d+)%$
The problem with the original is that you were mixing basic pattern syntax (where * represents a capture) with regular expression syntax (with the ? zero-or-one quantifier). I converted it to a full regular expression, since basic patterns don't support optional sections.
The second possibility is that your prompt doesn't end with a newline. Triggers are only processed and executed after a newline is received, so the prompt won't be scanned until the MUD sends a newline. This could still be the case even after the trigger is fixed, so if you notice that your trigger seems to "lag" (i.e. only fire after data comes in after the prompt), you should try enabling "Convert IAC EOR/GA to newline" in Game -> Configure -> Output, on the right. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Kaimarae
(34 posts) Bio
|
Date
| Reply #2 on Wed 11 May 2011 11:00 AM (UTC) |
Message
| That does help, but I substituted my trigger for yours and there is still no firing happening. I added in the dash at the end to be sure and still nothing.
This is what I'm using:
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Prompting"
match="^(\d+)h, (\d+)m, x?b? A:(\d+)%$"
send_to="12"
sequence="100"
>
<send>SetVariable("CurrentHealth", "%1")
SetVariable("CurrentEndurance", "%2")
SetVariable("CurrentMagic", "%3")</send>
</trigger>
</triggers>
I doubt it makes a difference, but I'm using MUSHclient 4.72? | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #3 on Wed 11 May 2011 12:08 PM (UTC) |
Message
| You don't have "regular expression" checked. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Kaimarae
(34 posts) Bio
|
Date
| Reply #4 on Wed 11 May 2011 12:44 PM (UTC) Amended on Wed 11 May 2011 12:48 PM (UTC) by Kaimarae
|
Message
| Good point. Checked it and still no dice. :/
My trigger:
<triggers>
<trigger
custom_colour="14"
enabled="y"
expand_variables="y"
group="Prompting"
match="^(\d+)h, (\d+)m, x?b? A:(\d+)% -$"
regexp="y"
send_to="12"
sequence="100"
>
<send>SetVariable("CurrentHealth", "%1")
SetVariable("CurrentEndurance", "%2")
SetVariable("CurrentMagic", "%3")</send>
</trigger>
</triggers>
Also this one:
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Prompting"
match="*"
send_to="12"
sequence="100"
>
<send>InfoClear()
SetStatus("H:", GetVariable("CurrentHealth"), " E:", GetVariable("CurrentEndurance"), " M:", GetVariable("CurrentMagic"), " Target: ", GetVariable("Target"))
</send>
</trigger>
</triggers>
I suspect the one above is pretty rudimentary and could be done a fair bit better. Sadly, it's the only part that works. My infobar reads:
Quote: H: E: M: Target: beaver
Again, any help would be greatly appreciated.
(In other news, amazing program Nick. Truly!) | Top |
|
Posted by
| Kaimarae
(34 posts) Bio
|
Date
| Reply #5 on Wed 11 May 2011 12:58 PM (UTC) |
Message
| As if the MUSHgods wanted to smite me in a fit of cruel irony, all of my triggers just stopped working. Even the simple do-nothing-but-highlight ones. I closed MUSHclient, nothing. Unchecked "Enable Triggers" then re-checked it... Nothing :/
Did a google search to see if anyone had encountered it before but couldn't find anything.
Help? | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #6 on Wed 11 May 2011 01:00 PM (UTC) |
Message
|
Quote:
This is my prompt:
869h, 230e, 657m xb A:50% -
I don't see an "e" in your trigger, so it won't fire. You have to look carefully at the line you are trying to match on, and your trigger.
Trigger, and regular expressions *do work*. Sometimes it can take a while, I have wasted quite a lot of time on them at times. But it always turns out that I haven't carefully looked at what I am trying to match on.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #7 on Wed 11 May 2011 01:02 PM (UTC) |
Message
|
Kaimarae said:
As if the MUSHgods wanted to smite me in a fit of cruel irony, all of my triggers just stopped working. Even the simple do-nothing-but-highlight ones.
Well you just added this:
And without ticking "keep evaluating" it has probably fired before all the other ones, thus overriding them. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Kaimarae
(34 posts) Bio
|
Date
| Reply #8 on Wed 11 May 2011 01:02 PM (UTC) Amended on Wed 11 May 2011 01:04 PM (UTC) by Kaimarae
|
Message
| GAH! You are correct! Sadly, I can't check to see if it works right now :|
Edit: Correction. You are legendary. I had it in there before (it was just disabled), but it didn't kill everything before I disabled it. Ah well, who cares now? xD
Sorry to bother you with something so silly. I appreciate the patience!
Edit 2: Is there a better way to accomplish what I did with my "*" trigger? | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #9 on Wed 11 May 2011 10:49 PM (UTC) |
Message
| What is the problem with just updating the info bar when you get the prompt? Why have the extra trigger? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Kaimarae
(34 posts) Bio
|
Date
| Reply #10 on Thu 12 May 2011 02:46 AM (UTC) Amended on Thu 12 May 2011 02:47 AM (UTC) by Kaimarae
|
Message
| I found for me that all the lines in the script fire at the same time, and the prompt gets updated with the last ticks stats. I'll give it a shot, but that's what it was doing before.
EDIT: Strike that. It seems to be working now. Woohoo! Redundant trigger removal! | 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.
28,365 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top