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
➜ Miniwindows
➜ miniwindow plugin with alias/trigger help
miniwindow plugin with alias/trigger help
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Tsheller
USA (14 posts) Bio
|
Date
| Mon 18 May 2009 09:12 AM (UTC) |
Message
| So I am looking to write a plug-in that I need a little help on.. I can understand the basic elements needed to accomplish what I need, but whenever I try to put them all together, it doesn't ever come out right.
I want to take the output of a command and put it into a miniwindow that is 20 lines long. A couple issues...
the output of the command 'map' isn't easily matchable. What I thought would be possible is have an alias (map) that sends the command map and turns on a trigger to capture everything until it matches the '>' character at the very end (which is the prompt) This would turn off the match everything trigger.
| Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #1 on Mon 18 May 2009 12:31 PM (UTC) |
Message
| Sounds like a good plan. Can you show us what you have managed to figure out so far? :) | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #2 on Mon 18 May 2009 11:08 PM (UTC) |
Message
| Your basic idea is sound. Some MUDs like Aardwolf help you by putting <MAPSTART> and <MAPEND> around their maps. Failing this, you probably need a trigger that matches as close as you can get to a map line.
For example, if the map starts with something like this it would help:
Failing something that specific, maybe map lines only have certain characters like compass directions, hyphens and so on?
So what you could do is, after you type "map" it enables a trigger that tries to match the very first map line. This trigger then enables another trigger that matches anything. Finally you need a way of knowing when the map ends, which might be a line that *doesn't* have things like hyphens and compass directions.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Tsheller
USA (14 posts) Bio
|
Date
| Reply #3 on Wed 20 May 2009 09:52 PM (UTC) Amended on Wed 20 May 2009 09:54 PM (UTC) by Tsheller
|
Message
| Hey thanks for the replies.
I know how to turn on and off triggers/alias/timers when other timers or triggers are 'triggered' or go off.. but how the actual script would be put together in a plugin.. As far as creating the window and getting that data to a miniwindow.. I get lost.
Nick -
Unfortunately for the map it first sends a blank line, then the characters could be an X or a + for the first line of the map, however, the only map characters are 0-9 numbers that can be up to six digits (102142) for example. The other characters would be, (,), -, |, <, >, ', %, or an actual ,.
Then there is a blank line
Then there is a legend describing what various characters and colors mean. This I don't really need to capture, if it could be triggered it could just be omitted from output.
<#****** / ||||||>
X 43026 X 42007 'X 43050
+ + X----------X X XXXXXXXXXXXX
X 42306 X 42004 42022 | 42023 |
+ +XXXXXXXXXXX X X XXXXXXXXXXXX
X 42059 | 42058 %X 42195 42387 X
+ XXXXXXXXXXXX----------X XXXXXXXXXXXXXXXXXXXXXXX
X < 42002>'| 42001 | 42003 43090 |
+XXXXXXXXXXXXXXXXXXXXXX----------X XXXXXXXXXXXXXXXXXXXXXXX
X 42010 42025 42008 42005 | 42015 X
XXXXXXXXXXXX----------X X X----------X +
X 43027 42197 42196 42303 X
+ XXXXXXXXXXXX X XXXXXXXXXXXX +
X 42198 42036 X
+ + X X X + +
' Up , Down % Up/Down
Inside City Road Trail Field Woods Forest
Hills Mountains Swamp Dock Cave Pasture Heath
Pit Leanto Lake River Ocean Reef Underwater
<#****** / ||||||>
(note: There is no blank first line in this one before the top of the map, but depending on the position of my avatar in the map, the first line can be entirely blank)
Unfortunately, I got so frustrated at the plugin I attempted I just deleted it thinking a fresh start was in order..
| Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 20 May 2009 11:50 PM (UTC) |
Message
| You have the problem well-described. I would like to see you try it and post the resulting plugin. Then we have something concrete to work with.
The basic plugin would be like the Aardwolf miniwindow mapper plugin:
http://www.gammon.com.au/forum/?id=8816
You just need to change how it detects the start and end of the map.
As you suggested before, once you type "map" you could enable the trigger that detects the first line. This could be a simple regular expression like this:
"^[X+',%\-<>()0-9 ]{10,}$"
That matches a line with the characters you mentioned, plus the numbers 0-9, or a space. However it only matches if the line consists entirely of at least then of those characters (to avoid false matches on really short lines).
You could change the 10 to something somewhat larger if the map is usually as large as you have shown.
Once that matches you can start capturing lines.
The legend could be handy as a way of detecting when the map ends, that is match on " ' Up , Down % Up/Down".
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Tsheller
USA (14 posts) Bio
|
Date
| Reply #5 on Thu 21 May 2009 07:47 PM (UTC) |
Message
| <triggers>
<trigger
enabled="y"
match="^[X+',%\-<>()0-9 ]{10,}"
script="map_redirect"
omit_from_output="y"
name="map_start"
sequence="100"
>
</trigger>
<trigger
enabled="n"
match="*"
script="map_redirect"
name="multi_line_map"
omit_from_output="y"
sequence="10"
>
</trigger>
<trigger
enabled="y"
match="^ \' Up \, Down \% Up\/Down$"
script="map_redirect"
omit_from_output="y"
name="map_end"
sequence="5"
>
</trigger>
</triggers>
So that's what I have to trigger.. which seems to work to catch the first lines. I got the map_end trigger to capture the end of the map like you suggested and that works just fine.
Can I add:
<send>
EnableTrigger (multi_line_map, true)
</send>
to the map_start trigger? And then make it false on the map_end?
Taking a look at the plug-in link you gave me, I really don't understand the script part. A lot of it seems unnecessary (like the linking) and it really just confuses me. I honestly haven't figured out the basic concept of taking the captured information and moving it to the miniwindow. | 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.
21,550 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top