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
➜ Not reading the 3rd Wildcard...
Not reading the 3rd Wildcard...
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Neoshain
(38 posts) Bio
|
Date
| Fri 12 Jul 2013 04:28 AM (UTC) |
Message
| Here is what I wish to match
Quote:
Mon Calamari MC80 Cruiser: Independence 1357 -2245 4112
And I'm trying to take all three coordinates and then add 300 to the final one. My following trigger:
<triggers>
<trigger
custom_colour="6"
enabled="y"
group="CapTracking"
ignore_case="y"
make_bold="y"
make_italic="y"
make_underline="y"
match="Mon Calamari MC80 Cruiser\: Independence (.*?) (.*?) (.*?)"
name="IndependanceTracking"
regexp="y"
send_to="12"
sequence="100"
>
<send>IndependenceLocation = ("%3"+300)
Note("%1")
Note("%2")
Note("%3")
Note(IndependenceHyper3)</send>
</trigger>
</triggers>
Is matching only the following:
Quote:
Mon Calamari MC80 Cruiser: Independence 1357 -2245 4112
I don't know what the problem is.
Lua Scripting. MUSHClient v4.84 | Top |
|
Posted by
| Neoshain
(38 posts) Bio
|
Date
| Reply #1 on Fri 12 Jul 2013 04:29 AM (UTC) |
Message
| Both of the Variables listed in send should read IndependenceHyper3, not IndependenceLocation | Top |
|
Posted by
| Neoshain
(38 posts) Bio
|
Date
| Reply #2 on Fri 12 Jul 2013 04:46 AM (UTC) |
Message
| One other thing, I would like to compensate for a possible variation on in the amount of spaces between a ship's name and the coordinates listed, how would I do this? | Top |
|
Posted by
| Nick Gammon
Australia (23,159 posts) Bio
Forum Administrator |
Date
| Reply #3 on Fri 12 Jul 2013 07:11 AM (UTC) |
Message
| It's always a bit fraught matching on .* because the "." wildcard matches spaces too, so hoping it will all work is pushing it. Specifically matching for numbers (and the minus sign) is better:
<triggers>
<trigger
custom_colour="6"
enabled="y"
group="CapTracking"
ignore_case="y"
make_bold="y"
make_italic="y"
make_underline="y"
match="Mon Calamari MC80 Cruiser\: Independence\s+([0-9-]+)\s+([0-9-]+)\s+([0-9-]+)"
name="IndependanceTracking"
regexp="y"
send_to="12"
sequence="100"
>
<send>
IndependenceHyper3 = %3 + 300
Note("%1")
Note("%2")
Note("%3")
Note(IndependenceHyper3)</send>
</trigger>
</triggers>
The above also allows for any number of spaces ( \s+ ). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Neoshain
(38 posts) Bio
|
Date
| Reply #4 on Fri 12 Jul 2013 03:01 PM (UTC) Amended on Fri 12 Jul 2013 03:04 PM (UTC) by Neoshain
|
Message
| Gotcha! Thank you! I had messed around with it a bit more last night and got this to work:
Mon Calamari MC80 Cruiser\: Independence (.*?) (.*?) (.*)
But yours, (being... ya know... YOURS) is better, of course. Thank you!
I'm slowly but surely become the Lua "expert" of my Mud's pbase and it's all thanks to you and the active forum members here! I've had a lot of people ask me to build custom triggers and plugins and stuff for them now, and whenever I get stumped, you guys are fast and so helpful! Thank you so very much. I hope to be one of the people who can help and answer questions as well as you some day! I've only been doing Lua since about March or April, and it's very casual, so I need this type of help! You Rock! | Top |
|
Posted by
| Cyote
(9 posts) Bio
|
Date
| Reply #5 on Sun 15 Sep 2013 10:23 PM (UTC) |
Message
| I would like to mention something about spaces here as Nick previously wrote it in his help documentation.
1. For a single space the patern should be \s
2. For a single-multiple spaces Patern could be \s+?
3. For a non-space or multiple spaces Patern could be \s*?
If we want to assign these spaces to a wildcard () is used.
like (\s*) will assign spaces to relative wildcard.
If we want to give a name to wildcard we can use,
(?P<test>\s*)
which will be probably nil. (for spaces)
to be able to use it in triggers/aliases etc since it has more then 1 character you must use %<test>.
Do not forget to put use "" if %<test> is a string.
| 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.
18,383 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top