|
Grimpnog Newbie
Joined: 06 Dec 2005 Posts: 6
|
Posted: Tue Dec 06, 2005 7:45 pm
A question on triggering |
Greetings all! I am a rank novice at scripting and so I apologize in advance if the answer to my question is stunningly obvious!
I want to set up triggers on specific locations on the MUD I play. I want to remind myself what my important aliases are from that specific point on the map. For example, I may want to trigger on this location:
A Crossroads (n, s, e and w)
Suppose I want to remind myself that from here I need to use alias "bpack" to go to the nearby location where a big pack can be quested. And a second "cant" where a magical canteen can be uncovered. I would like the output to look like:
A Crossroads (n, s, e and w) (bpack) (cant)
I have been able to use the #echo command triggered on "A Crossroads" and then it puts the (bpack) (cant) on the NEXT line (where I don't want it). It will NOT trigger at all on "A Crossroads (n, s, e and w)". Apparently the directionals mess it up.
Can someone help me?
Thank you for sharing your collective wisdom. |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Dec 06, 2005 7:59 pm |
Are you using the zMud Mapper?
|
|
|
|
Grimpnog Newbie
Joined: 06 Dec 2005 Posts: 6
|
Posted: Tue Dec 06, 2005 8:03 pm |
No I'm not. Is that going to prevent me from doing this?
|
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Dec 06, 2005 8:26 pm |
The use of the mapper isn't important.
Best idea is to make sure you make these kinds of a triggers for Unique room names.
() are used by zMud to capture variables. When we try and capture ( and ) in a trigger we put a ~ in front of it to tell zMud to capture it as a bracket and not as a potential variable.
#TRIGGER {^A Crossroads ~((*)~)} {#SUB {A Crossroads ~(%1~) (bpack) (cant)}}
I chose the #SUB command to substitute into the line things you want. Red things are things copied from the original trigger, blue things are notes for yourself to answer. |
|
|
|
Grimpnog Newbie
Joined: 06 Dec 2005 Posts: 6
|
Posted: Tue Dec 06, 2005 9:07 pm |
Will this work if the directions themselves are part of the uniqueness of the room?
For example is: A Crossroads (n, w, e and s)
different from: A Crossroads (n, w, enter and ne) |
|
|
|
Grimpnog Newbie
Joined: 06 Dec 2005 Posts: 6
|
Posted: Tue Dec 06, 2005 9:29 pm |
Hmmm... sorry to be obtuse, but I can't seem to get this to work with even a simple "todo".
For example, the trigger doesn't work:
#TRIGGER {^Williamsburg~((*)~)} {jump}
Apparently the room title isn't satisfying the trigger conditions.
But if I do:
#TRIGGER {Williamsburg} {jump}
It works fine.
|
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Dec 06, 2005 9:42 pm |
Ah, then it will be important to write it as it appears.
#TRIGGER {^A Crossroads ~(n, w, e and s~)} {#SUB {A Crossroads ~(n, w, e and s~) (bpack) (cant)}}
#TRIGGER {^Williamsburg ~((*)~)} {#SUB {Williamsburg ~ (%1~) (jump)}}
Quote: |
SUBSTITUTE
Syntax: #SU string [string]
This command is used in conjunction with triggers to change the text matched by the last trigger pattern to something else. It is useful for removing clutter on the screen. You can also use this command to directly create the substitute trigger. Substituted strings are not processed by further triggers.
SUBSTITUTE example
#TRIGGER {(*) tells you,} {#SUB {%1:}}
Replaces all lines received from the MUD of the form xxx tells you, with the text xxx: . This saves room on the screen and is especially useful in a subwindow that captures text matching a pattern.
#SUB Zugg zMUD-Guru
Substitutes any occurrence of the string "Zugg" with the new string "zMUD-Guru".
#SUB {lt(%w)} {%lower(%1)}
This tricky command creates a trigger that substitutes the text "lt" followed by any word with the lowercase version of the word. For example, the string "ltZUGG" would be replaced with "zugg". This shows how to use wildcards and variables with the substitute command which makes it very powerful.
|
|
|
|
|
Grimpnog Newbie
Joined: 06 Dec 2005 Posts: 6
|
Posted: Tue Dec 06, 2005 10:06 pm |
Still not working...
The room title appears exactly as:
Gromptahr(nw, n, e, enter and ne)
I typed:
#TRIGGER {^Gromptahr~(nw, n, e, enter and ne~)} {#SUB {Gromptahr~(nw, n, e, enter and ne~) (bpack) (cant)}}
and the trigger doesn't fire. I wasn't worried so much about the second bit... I thought I could double check that the first half
was working correctly by just substituting a simple command like "jump" or "sit" for the action to be taken if the trigger fired.
In any case, the trigger pattern doesn't seem to be matching up with the room title regardless of what the value of the trigger is. |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Tue Dec 06, 2005 10:32 pm |
I enter into my command line:
#TRIGGER {^Gromptahr~(nw, n, e, enter and ne~)} {#SUB {Gromptahr~(nw, n, e, enter and ne~) (bpack) (cant)}}
#SH Gromptahr(nw, n, e, enter and ne)
Result:
Gromptahr(nw, n, e, enter and ne) (bpack) (cant)
Either you have an option different than mine or the trigger isn't firing. What does
#SH Gromptahr(nw, n, e, enter and ne)
Result in? |
|
|
|
Grimpnog Newbie
Joined: 06 Dec 2005 Posts: 6
|
Posted: Tue Dec 06, 2005 11:53 pm |
It worked!
You are aptly titled "Wizard"!
My thanks for your patience. |
|
|
|
|
|