Catching the exits with Tinyfugue

by Morik

Back to Mechanic's Corner.

Morik2005-10-16 12:58:06
For alger:

CODE


#
# My playing around with capturing exits
#

/def -mregexp -t"^You see (a single exit|exits) leading (.*)$" trig_capture_exits_1 = /start_exits %P2

/def start_exits = \\
       /test_exits %* %; \\        /def -p255 -1 -q -F -mregexp -h"PROMPT (.*?)h, (.*?)m, (.*?)e, " trig_tmp_prompt_exits = /undef trig_capture_exits %; \\
       /def -mglob -t"*" trig_capture_exits = /test_exits %%*

/def test_exits = \\
       /while ({#}) \\
               /let dir=$ %; \\
               /let dir=$ %; \\
               /echo_notice EXIT: %dir %; \\
               /shift %; \\
       /done
Vesar2005-10-16 14:14:54
now.. how about in zMud? I've been working on that problem for a while
Morik2005-10-16 15:00:43
QUOTE(Vesar @ Oct 16 2005, 10:14 PM)
now.. how about in zMud?  I've been working on that problem for a while
206411



Hah. I can't run zmud on my ibook. Maybe next year, when Apple release intel-based laptops and someone allows it to run windows programs.. wink.gif
Alger2005-10-16 16:44:03
CODE

;>----------------------------------------------------------------------------------------
;> PROMPT MACRO                                                                                  
;>            -attached to the main prompt trigger to echo the saved directions
;>----------------------------------------------------------------------------------
/def directions_echo_prompt = \\
          /if ({directions_gate} = 1) \\
                    /echo -aCblue -p EXITS: @{hCyellow}%directions_array %;\\
                    /unset directions_array %;\\
                    /set directions_gate=0 %;\\
          /endif

;>---------------------
;> TRIGGER LINES
;>---------------------

/def -ag -mregexp -t'^You see (a single exit|exits) leading ' exit_capture = /set directions_gate=1 %; /start_exits %PR %; /set noprompt=1

/def start_exits = \\
         /direction_filter %* %;\\
         /def -p999 -1 -q -F -mregexp -h"PROMPT (.*?)h, (.*?)m, (.*?)e, (.*?)p, (.*?)en, (.*?)w" trig_tmp_prompt_exits = /undef exit_capture_2 %;\\
         /def -ag -mglob -t'*.' exit_capture_2 = /direction_filter %%*

;>------------------------------
;> DIRECTION FILTERING
;>------------------------------

/def direction_filter = \\
         /while ({#}) \\
                    /let directions=$ %;\\
                    /let directions=$ %;\\
                    /let directions=$ %;\\
                    /let directions=$ %;\\
                    /let directions=$ %;\\
                    /let directions=$ %;\\
                    /set directions_array=%directions_array %directions %;\\
                    /shift %;\\
         /done




Thanks Morik. Cleaned it up a bit, was a bit buggy.

FUNCTION: Nothing really just makes those exits easier to read for me, but it does have pretty much all the information you need to create a navigation bar I guess. Since all your directions will be in the directions_array you can extract them with a while statement and use them to display current exits etc. Further replacing would be required though.
Morik2005-10-16 17:54:01
not a problem.
Unknown2005-10-16 23:42:15
Sweet, other people actually post code now! This is something I've actually wanted for a long time but never got around to messing with, thanks! biggrin.gif

In a day or two I'll be posting my new forging, bashing, and targeting systems.
Morik2005-10-17 01:27:16
hah, I only posted it because Alger asked me about it and I couldn't get the code to him quickly. The forums was the fastest way to.

Now we just need a tinyfugue sub-board. tongue.gif
Unknown2005-10-17 02:48:44
QUOTE(morik @ Oct 16 2005, 08:27 PM)
Now we just need a tinyfugue sub-board. tongue.gif
206789



AGREED!

I imagine those Zmud and Mushclient losers would want one to then tongue.gif
Tiran2005-10-17 05:19:05
QUOTE(Alger @ Oct 16 2005, 10:44 AM)
CODE

;>---------------------
;> TRIGGER LINES
;>---------------------

/def -ag -mregexp -t'^You see (a single exit|exits) leading ' exit_capture = /set directions_gate=1 %; /start_exits %PR %; /set noprompt=1

206466



Just a quick comment about anchoring to the start of the line. There's currently a bug when you're doing a quick look or using brief mode to move around rooms. If you have weather turned on, and there's absolutely nothing else in the room (demesne, plants, objects, etc...), then the exit line isn't properly put on the next line, but follows immediately after the weather. Annoying, but doing a full look, or checking 'exits' will give a parsable line.

That being said, seeing this code has prompted me to try and tinker a little more with my tf setup. So many nifty things that can be done, but I never get around to doing them.
Morik2005-10-17 08:47:20
QUOTE(Tiran @ Oct 17 2005, 01:19 PM)
Just a quick comment about anchoring to the start of the line. There's currently a bug when you're doing a quick look or using brief mode to move around rooms. If you have weather turned on, and there's absolutely nothing else in the room (demesne, plants, objects, etc...), then the exit line isn't properly put on the next line, but follows immediately after the weather. Annoying, but doing a full look, or checking 'exits' will give a parsable line.

That being said, seeing this code has prompted me to try and tinker a little more with my tf setup. So many nifty things that can be done, but I never get around to doing them.
206925



I'm happy to share my system out with people. Collaboration is how we'll all get better at this!
Alger2005-10-17 23:32:06
What you mentioned is a problem of that script but its not only in the anchoring. The event that you mentioned actually makes the direction line into a short multiline trig that makes it a bit hard to capture. I reckon morik has to go make a script for proper multiliner captures! yey.

Also that script is a bit buggy in the sense that putting a anyline trig screws it up a bit since the direction line is not always just above the prompt line.

Also blackout screws it over.
Unknown2006-01-13 18:51:27
I think this is rather nice:
CODE

;;; Exit catching
/set status_height=2
/status_add -x -r1 exits
/def -mregexp -t"You see (exits|a single exit) leading (.*)" exit_t = \\
   /set exits=Exits: $

This adds a new row to the status bar and puts the exits there.