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 Expressions
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Terry
USA (87 posts) Bio
|
Date
| Sat 14 Jul 2007 08:55 PM (UTC) Amended on Sat 14 Jul 2007 08:56 PM (UTC) by Terry
|
Message
| In a mud I'm playing, there's an elevator that I use all the time. The syntax is 'press button <#>' where <#> is an integer from 0 to 6. I'm trying to set up an alias so all I have to do is type 'p<#>'. However, I only want it to trigger if the wildcard is an integer from 0-6. All I was able to figure out was:
^p(0|1|2|3|4|5|6)$
press button %1
For this alias, it wasn't that bad. But what I'm worried about is when I want to have a range of integers that is something like 0-500. Is there a way I can use a range of integers to mimic this? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 14 Jul 2007 09:26 PM (UTC) |
Message
| Well, you could have done:
^p([0-6])$
It gets a bit fiddly with larger numbers, so it would be easier to do "send to script" and in that do something like this:
if %1 >= 0 and %1 <= 44 then
Send ("Press button %1")
else
Note ("Button %1 out of range")
end -- if
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Terry
USA (87 posts) Bio
|
Date
| Reply #2 on Sat 14 Jul 2007 09:59 PM (UTC) |
Message
| How exactly does the "send to script" feature work? do i have to write another file that it goes to? or do i just write the script code in the "Send:" box? I've always wondered that, and that's why I've never really used the feature :( I couldn't find documentation that specifically said -where- to put it. I only saw stuff that said -how-. | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #3 on Sat 14 Jul 2007 10:12 PM (UTC) |
Message
| Send to Script in an alias or trigger allows the Script itself to be placed in the box that you would normally place Send To World commands. You can also do it another method which is specifying a script subroutine, that is located in the script file for the world. This CAN be preferable depending on situations, but I, myself have never wanted a script file, I use plugins, and World Variables to transfer data around.
Laterzzz,
Onoitsu2 | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Sun 15 Jul 2007 12:28 AM (UTC) |
Message
| |
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,103 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top