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.
Entire forum
➜ MUSHclient
➜ Tips and tricks
➜ Multi-line triggers help needed
Multi-line triggers help needed
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Verdilak
(6 posts) Bio
|
Date
| Mon 24 Jan 2011 09:18 PM (UTC) |
Message
| The mud that I play allows for you to scan and see every mob in the surrounding directions, as well as any tokens that may be around as well. For example:
Nearby North:
- the citizen
- Marshall Diana
Nearby East:
- the citizen
- the Ofcol cityguard
- Sam
Nearby West:
- Jim the Blacksmith
Not Far North:
- the Ofcol cityguard
Far off North:
- the citizen
Whenever there is a token, it might show up as:
Nearby North:
- the citizen
- Marshall Diana
Nearby East:
- the citizen
- the Ofcol cityguard
- Sam
- Something Shiny
Nearby West:
- Jim the Blacksmith
Not Far North:
- the Ofcol cityguard
Far off North:
- the citizen
I have the following trigger set up in order to go and get the tokens whenever they are seen in the scan screen, like so:
<trigger
enabled="y"
group="Multi Line"
lines_to_match="2"
keep_evaluating="y"
match="Nearby East\:\n \- Something Shiny\Z"
multi_line="y"
regexp="y"
sequence="100"
>
<send>e
get all
scan</send>
</trigger>
I have a trigger set up for every direction and for the three lengths of distance that can be seen through scan (Nearby, Not Far, Far Off).
My problem is that my trigger only is triggered when the match is exactly matched
Nearby East:
- Something Shiny
and not when there are additional lines between the "Nearby East:" and the "- Something Shiny", like so:
Nearby East:
- the citizen
- the Ofcol cityguard
- Sam
- Something Shiny
How would I set up the trigger to allow any number of lines between the "Nearby East:" and the "- Something Shiny" that would also allow no lines to be between them? | Top |
|
Posted by
| Verdilak
(6 posts) Bio
|
Date
| Reply #1 on Mon 24 Jan 2011 10:12 PM (UTC) |
Message
| Okay, the above was me trying to convert over a zmud script that i found while cleaning out some old folders and want to use with MUSHclient.
If it is easier to see the original zmud script:
#CLASS {dwarf}
#CLASS {dwarf|scan} {disable}
#ALIAS scan {#VAR dir {};#VAR distance 0;#T+ scan;~scan;emote done} "dwarf"
#VAR imps {31} {_nodef} "dwarf"
#TRIGGER {Bupu done} {eat warp} "dwarf"
#TRIGGER {Like anyone really cares?} {eat warp} "dwarf"
#TRIGGER {You eat a warp pill.} {scan} "dwarf"
#TRIGGER {You do not have that item.} {g all.warp corpse;eat warp} "dwarf"
#TRIGGER {Nearby (%w):} {#VAR dir %1;#VAR distance 1;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}} "dwarf|scan"
#TRIGGER {Not Far (%w):} {#VAR dir %1;#VAR distance 2;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}} "dwarf|scan"
#TRIGGER {Far off (%w):} {#VAR dir %1;#VAR distance 3;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}} "dwarf|scan"
#TRIGGER {- Something Shiny} {#IF (@distance = 0) {~get all};#IF (@distance = 1) {@dir;~get all;@backtrack};#IF (@distance = 2) {@dir;@dir;~get all;@backtrack;@backtrack};#IF (@distance = 3) {@dir;@dir;@dir;~get all;@backtrack;@backtrack;@backtrack}} "dwarf|scan"
#TRIGGER {Right (%w):} {#VAR dir %1;#VAR distance 0} "dwarf|scan" | Top |
|
Posted by
| Nick Gammon
Australia (23,121 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 25 Jan 2011 10:17 AM (UTC) Amended on Tue 25 Jan 2011 10:18 AM (UTC) by Nick Gammon
|
Message
| It *can* be done with multi-line triggers, but I prefer in cases like this to use 3 triggers:
- Match: Nearby * or Far Off *
This is the start of a sequence, and turns on the next two triggers (and you remember which direction it is). At this point you also clear the table of people who are in this direction.
- Match: - *
This matches whoever (like "the citizen"). You remember each of these in a table.
- Match: *
This is lower priority than the second trigger, and fires when you are out of matching people. This turns off itself and the second trigger. In other words, it matches any line not starting with "-".
With a bit of juggling you can make all this work. In fact I seem to remember that something like this came up a while back. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Verdilak
(6 posts) Bio
|
Date
| Reply #3 on Tue 25 Jan 2011 09:45 PM (UTC) |
Message
| So you are saying that it would be simpler and easier/better to have three triggers for each of the distance types with the match as below:
match="Nearby *"
match="Not Far *"
match="Far Off *"
However, what would I send? I am wanting it to be automated. In other words, if I scan and see that there is Something Shiny Far Off West, then I would travel 3w and get the Something Shiny.
I am also confused about how the client will remember what direction it is supposed to remember.
And table? How would I set that up?
I'm sorry, I'm just more confused now that I was before lol. | Top |
|
Posted by
| Verdilak
(6 posts) Bio
|
Date
| Reply #4 on Tue 25 Jan 2011 10:07 PM (UTC) |
Message
| Okay, after thinking about it for a few minutes, I am guessing that I would set up the three direction triggers like the following
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="Nearby *"
send_to="12"
sequence="100"
>
<send>
if "%1" == "east" then
Send ("e")
if "%1" == "west" then
Send ("w")
if "%1" == "north" then
Send ("n")
if "%1" == "south" then
Send ("s")
if "%1" == "up" then
Send ("up")
if "%1" == "down" then
Send ("down")
else
Send ("scan")
end -- if</send>
</trigger>
</triggers>
However, that won't work, because it will be triggered with every scan and my character will be moving around with no meaning. I need it to only move in the direction that a "- Something Shiny" is tied to, but I don't know how to make that work.
Because to search for what I am really looking for ("- Something Shiny"), I am looking at something like the following
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="- *"
send_to="12"
sequence="100"
>
<send>
if "%1" == "Something Shiny" then
Send ("")
end -- if</send>
</trigger>
</triggers>
but I have no clue what to send.
Yeah, still way freakin lost. | Top |
|
Posted by
| Nick Gammon
Australia (23,121 posts) Bio
Forum Administrator |
Date
| Reply #5 on Wed 26 Jan 2011 04:01 AM (UTC) Amended on Wed 26 Jan 2011 04:02 AM (UTC) by Nick Gammon
|
Message
| OK, to go to where the shiny thing is won't be too hard:
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="- Something Shiny"
send_to="12"
sequence="100"
>
<send>
if direction then
Send (direction)
direction = nil
end -- if
</send>
</trigger>
<trigger
enabled="y"
match="Nearby *:"
send_to="12"
sequence="100"
>
<send>direction = "%1"
</send>
</trigger>
<trigger
enabled="y"
match="Not Far *:"
send_to="12"
sequence="100"
>
<send>direction = "%1"
</send>
</trigger>
</triggers>
|
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
Basically it remembers a direction if it sees "Nearby x" or "Not Far x", but doesn't do anything yet.
Then if it sees "- Something Shiny" it goes in the remembered direction. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
17,785 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top