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
➜ Matching Question
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Nate7240
(16 posts) Bio
|
| Date
| Wed 10 Mar 2010 10:56 PM (UTC) |
| Message
| Alright so I've created a mini window that displays a map that is given to me through the output on the game Aetolia. Now, it does exactly what I want it to(omits the map from the output and redirects it into the miniwindow) but only when I tell it specifically where the map starts and where the map ends. Here is a chunk of code to help (note, this is based off of Nick's inventory alias):
Checks to see if map starts
-- Waiting for map to start
local x = wait.match ("---------- v10009 -----------", 5)
if not x then
ColourNote ("white", "blue", "No map received within 5 seconds")
return
end -- if
Checks to see if end of map
-- Check to see if end of map
if string.match (line, "^----------- 4:2:0 -----------") then
break
end -- if
now the start lines(---------- v10009 -----------) and end lines(----------- 4:2:0 -----------) can vary, but not by much I believe. The problem is that I can't make those two lines match in different rooms because the numbers change. I was thinking that you most likely need to use regular expressions, but being as I am not the brightest crayon in the box, I need your help. Will be greatly appreciated, thanks. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 10 Mar 2010 11:46 PM (UTC) Amended on Wed 10 Mar 2010 11:48 PM (UTC) by Nick Gammon
|
| Message
| Well that is pretty simple. Did you read up on regular expressions?
To do the first one:
local x = wait.match ("%-+ %a%d+ %-+", 5)
%a means a letter and %d+ means one or more numbers.
And since "-" has a special meaning, put a % before it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nate7240
(16 posts) Bio
|
| Date
| Reply #2 on Thu 11 Mar 2010 12:11 AM (UTC) |
| Message
| | Alright great, thanks. And as for the end line (----------- 4:2:0 -----------), there can be any number of digits where each number is located, and there can be a "-" in front of each number. For example (----------- -44:-22:-00 -----------). Also, there can be a different amount of -'s before and after the numbers. It's the last piece to the puzzle :P. | | 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.
11,504 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top