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
➜ Regular Exp Trigger problem
|
Regular Exp Trigger problem
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Mon 30 Jan 2006 04:12 AM (UTC) Amended on Mon 30 Jan 2006 04:16 AM (UTC) by David Berthiaume
|
| Message
| Right then. I've been having a go at this for some time now. I've exhausted everything that I can think of on how to do this.
My prompt changes at various times, depending on what I'm doing.
If I'm just hanging around it looks like this:If I'm in combat it looks like this:<98%> / <7,056/7,895> vs. <232>
When I gain power level it looks like this:<100%> / <7,450/7,895> +197 Max Powerlevel
Now then. The problem I'm having is I want to set a trigger to constantly monitor my max power level. I need it to keep track during combat, and during non combat periods. Sounds simple right? Well, I wish it were. Here is my trigger, followed by what I see on the screen(I'm using send to output to check the wildcards)<triggers>
<trigger
custom_colour="2"
enabled="y"
match="^(^\<(.*)\%\> \/ \<(.*)\/(.*)\>$|^\<(.*)\%\> \/ \<(.*)/(.*)\> vs. \<(.*)\>$)$"
regexp="y"
repeat="y"
send_to="2"
>
<send>%1
%2
%3
%4</send>
</trigger>
</triggers>
My output looks like this:<100%> / <8,774/8,774> vs. <4,397>
<100%> / <8,774/8,774> vs. <4,397>
100
8,774
8,774> vs. <4,397
That was not exactly what I was looking for.
The first line is the actual prompt, the second is the whole line as a wild card, the third is the 2nd wild card, the fourth is the 3rd wildcard, but the fourth line keeps screwing up. I can't figure out how to get it to ignore that vs. part.
I know the trigger is working properly. When not in combat I get:<100%> / <9,212/9,212>
<100%> / <9,212/9,212>
100
9,212
9,212
Which is exactly what I'm supposed to be getting. it's matching on the two different prompt lines. The problem is It's not breaking up the wildcards in the combat prompt properly. | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #1 on Mon 30 Jan 2006 04:21 AM (UTC) |
| Message
| This trigger works fine though:<triggers>
<trigger
custom_colour="2"
match="^\<(.*)\%\> \/ \<(.*)/(.*)\> vs. \<(.*)\>$"
regexp="y"
repeat="y"
send_to="2"
>
<send>%1
%2
%3
%4
%5
%6
%7</send>
</trigger>
</triggers>
| | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #2 on Mon 30 Jan 2006 04:28 AM (UTC) |
| Message
| I solved the problem, just not the way I wanted too, but I'm not gonna argue with results.
I have 2 different triggers. They both work, they both give me the information that I want. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Mon 30 Jan 2006 07:39 PM (UTC) |
| Message
| I spent a bit of time looking at that. I think the "|" has a precedence you don't expect. This modified version works for all 3 input types:
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="^\<(.*?)\%\> \/ \<(.*?)/(.*?)\>( vs. \<(.*)\>)?| (\+[\d,]+ Max Powerlevel)?$"
regexp="y"
repeat="y"
send_to="2"
>
<send>%%1 = %1
%%2 = %2
%%3 = %3
%%4 = %3</send>
</trigger>
</triggers>
Here is my test results from the lines you supplied:
<100%> / <8,291/8,291>
%1 = 100
%2 = 8,291
%3 = 8,291
%4 = 8,291
<98%> / <7,056/7,895> vs. <232>
%1 = 98
%2 = 7,056
%3 = 7,895
%4 = 7,895
<100%> / <7,450/7,895> +197 Max Powerlevel
%1 = 100
%2 = 7,450
%3 = 7,895
%4 = 7,895
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #4 on Wed 01 Feb 2006 11:53 PM (UTC) |
| Message
| That's awesome. The only problem I see with your trigger is the fact that I need all the numbers to be wild cards.
I don't know what I'd do to change what you have to be all wild cards. | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #5 on Thu 02 Feb 2006 06:06 AM (UTC) |
| Message
| Started playing with it. Works great. I only got a short chance to check out that trigger and what it actually did. I understand what it does now, I never thought to try it the way you did.
Now it's just a matter of condensing the cosiderable amount of code that I have in the other triggers, all into that one.
Thanks a bunch Nick, your program is amazing, and the fact that you take time to go through damned nearly every post and atleast comment really shows you care. It must be one busy day for you. | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #6 on Thu 02 Feb 2006 08:19 AM (UTC) |
| Message
| | After trying to get the +232 Max Power Level part to be captured as a wildcard, I've totaly messed it up... I can't figure it out. I guess it'd help if I haven't been up for 18 hours... Maybe I'll have figured it out by tommorrow, if you haven't already posted why it isn't working by then. | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #7 on Thu 02 Feb 2006 08:29 AM (UTC) Amended on Thu 02 Feb 2006 08:30 AM (UTC) by David Berthiaume
|
| Message
| I tried something. It worked... I don't know if there is a better way to do this, but this worked.<triggers>
<trigger
custom_colour="2"
enabled="y"
keep_evaluating="y"
match="^\<(.*?)\%\> \/ \<(.*?)/(.*?)\>(( vs. \<(.*)\>)?| (\+(.*?) Max Powerlevel)?)$"
regexp="y"
repeat="y"
send_to="2"
>
<send>%%1 = %1
%%2 = %2
%%3 = %3
%%6 = %6
%%8 = %8</send>
</trigger>
</triggers>
Just what the Doc ordered.
EDIT: Is this an advanced type of Reg Exp trigger? Or is this fairly common? | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #8 on Thu 02 Feb 2006 08:40 AM (UTC) Amended on Thu 02 Feb 2006 08:44 AM (UTC) by David Berthiaume
|
| Message
| <triggers>
<trigger
custom_colour="2"
enabled="y"
expand_variables="y"
match="^\<(.*?)\%\> \/ \<(.*?)/(.*?)\>(( vs. \<(.*)\>)?| (\+(.*?) Max Powerlevel)?)$"
regexp="y"
repeat="y"
send_to="12"
>
<send>maxpl = "%3"
form = "@Form"
SetVariable "MaxPowerLevel", maxpl
if form = "Super Saiyan" then
expectedgain = Int((maxpl / 2) * .05)
elseif form = "Super Saiyan 2" then
expectedgain = Int((maxpl / 3) * .05)
elseif form = "Super Saiyan 3" then
expectedgain = Int((maxpl / 4) * .05)
elseif form = "Ultimate Super Saiyan" then
expectedgain = Int((maxpl / 2) * .05)
elseif form = "2" then
expectedgain = Int((maxpl / 1.25) * .05)
elseif form = "3" then
expectedgain = Int((maxpl / 1.75) * .05)
elseif form = "4" then
expectedgain = Int((maxpl / 2.625) * .05)
else
expectedgain = Int(maxpl * .05)
end if
gain = "%8"
gamesessiongain = Int(GetVariable("GameSessionGain")) + gain
powerlevelgain = Int(GetVariable("PowerLevelGained")) + gain
SetVariable "PowerLevelGained", FormatNumber(powerlevelgain,0,0,0,-1)
SetVariable "GameSessionGain", FormatNumber(gamesessiongain,0,0,0,-1)
Note "Current gain is: +" & FormatNumber(powerlevelgain,0,0,0,-1) & " | Expected Gain is: +" & FormatNumber(expectedgain,0,0,0,-1)</send>
</trigger>
</triggers>
Current trigger
Current problem:Error number: -2146828275
Event: Execution of line 23 column 1
Description: Type mismatch: 'gain'
Line in error:
Called by: Immediate execution
Edit: I just realized what the problem is...
It's looking for the Wildcard %8 when there is no wild card present in the base form sooooooo It triggers that error.
Ok. Now I have no idea what to do. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #9 on Thu 02 Feb 2006 09:52 PM (UTC) |
| Message
| |
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #10 on Thu 02 Feb 2006 11:22 PM (UTC) Amended on Thu 02 Feb 2006 11:26 PM (UTC) by David Berthiaume
|
| Message
| How do I do this from inside the trigger itself? I am not calling from a sub. I'm doing it all from within the trigger.
x = GetTriggerWildcard ("8")
Will that work?
Or does it have to have a trigger name?
x = GetTriggerWildcard ("", "8") | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #11 on Fri 03 Feb 2006 12:17 AM (UTC) |
| Message
| Yes, you have to give it the name of the trigger, as the documentation said. You can still access the name with "send to script", like this:
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="Exits: *"
name="mytrigger"
send_to="12"
sequence="100"
>
<send>Note (GetTriggerWildcard ("mytrigger", 1))
</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #12 on Fri 03 Feb 2006 12:43 AM (UTC) |
| Message
| Ok, I see what you are saying. I understand how GetTriggerWildcard works now.
However, I am still having the same problem...
How do I get it to ignore an emply wildcard?
If it comes back as an empty string, and the wildcard is not there, I want it to do nothing... but carry on as usual, but if it comes back as there being a value in the string and the wildcard is there, I got all kinds of things I want it to do. | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #13 on Fri 03 Feb 2006 01:07 AM (UTC) Amended on Fri 03 Feb 2006 01:11 AM (UTC) by David Berthiaume
|
| Message
| Right then, this is what I got so far. I'm certain there is a better way to do this, but I only have help files to go on.<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^\<(.*?)\%\> \/ \<(.*?)/(.*?)\>(( vs. \<(.*)\>)?| (\+(.*) Max Powerlevel)?)$"
name="Prompt"
regexp="y"
repeat="y"
send_to="12"
>
<send>myen = GetTriggerWildCard ("Prompt", 1)
mypl = GetTriggerWildcard ("Prompt", 2)
mxpl = GetTriggerWildcard ("Prompt", 3)
mbpl = GetTriggerWildcard ("Prompt", 6)
if isempty (mbpl) then
else
ColourNote "white", "red", mbpl
end if
gain = GetTriggerWildcard ("Prompt", 8)
if isempty (gain) then
else
ColourNote "white", "red", gain
end if</send>
</trigger>
</triggers>
The only problem with this trigger is that it keeps two empy spaces below the trigger for the notes, as though it's trying to world.note something(meaning, the space is there as if it's noting a blank line), but it isn't noting anything. I tried getting it to Note "wildcard is not present" when the wildcard wasn't present, but it did not work.
Please however note, that when the wildcard IS there, it does note the wild card properly. | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #14 on Fri 03 Feb 2006 03:49 AM (UTC) |
| Message
| | I've been playing with this isempty for HOURS now. It doesn't work. I've tried various permutations on it. I can not get it to work. | | 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.
67,487 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top