Register forum user name Search FAQ

Gammon Forum

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 ➜ Temporary Triggers

Temporary Triggers

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gore   (207 posts)  Bio
Date Wed 04 Feb 2004 12:48 PM (UTC)
Message
Hey what's up, was wondering if someone could tell me the command to make a temporary trigger via alias.. or script? I can't seem to find it when I search the forum/help files for mushclient

Thank you
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 04 Feb 2004 08:07 PM (UTC)
Message
See this page:

http://www.gammon.com.au/scripts/doc.php?function=AddTrigger

Add (or OR) 16384 to the trigger flags when you create it.

However do you really want a temporary trigger? A temporary trigger is one that is not written to the world file.

For a trigger that only works for a while you may really want to either disable or delete it. See:

http://www.gammon.com.au/scripts/doc.php?function=EnableTrigger

and

http://www.gammon.com.au/scripts/doc.php?function=DeleteTrigger


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Gore   (207 posts)  Bio
Date Reply #2 on Sun 08 Feb 2004 08:49 PM (UTC)
Message
Yeah, in ZMud, I used it as a temporary trigger.. in MUSHClient, I'm having a hard time having Multiple triggers of the same pattern that do different things. I read the help file on sequencing, and I changed the sequence on of one of my triggers to 99 and left the other with the same pattern at 100, but then the one that I changed didn't work anymore. Any ideas?
Top

Posted by Gore   (207 posts)  Bio
Date Reply #3 on Sun 08 Feb 2004 09:02 PM (UTC)
Message
Err, here's an example of what I mean.. with the sequencing..

<aliases>
<alias
script="selfish_off"
match="gen"
enabled="y"
group="anti_theft"
sequence="100"
>
</alias>
<alias
script="selfish_on"
match="self"
enabled="y"
group="anti_theft"
sequence="100"
>
</alias>
</aliases>
<triggers>
<trigger
custom_colour="3"
enabled="y"
match="You have recovered equilibrium."
script="auto_bash"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>stand</send>
</trigger>
<trigger
custom_colour="3"
group="anti_theft"
match="You have recovered equilibrium."
name="generosity_eq"
script="generosity_on_eq"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>stand</send>
</trigger>
<trigger
custom_colour="6"
enabled="y"
group="anti_theft"
match="^(.*?)h\, (.*?)m ex\-A feeling of generosity spreads throughout you\.$"
name="generosity_trigger"
regexp="y"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>selfishness</send>
</trigger>
</triggers>

Sub Selfish_on (a,b,wildcard)
Selfishness = "1"
World.Send "selfishness"
World.EnableTrigger "generosity_trigger", TRUE
End Sub

Sub Selfish_off (a,b,wildcard)
Selfishness = "0"
World.Send "generosity"
World.EnableTrigger "generosity_trigger", FALSE
End Sub

Sub Generosity (a,b,wildcard)
World.EnableTrigger "generosity_eq", TRUE
End Sub

Sub Generosity_on_eq (a,b,wildcard)
World.Send "selfishness"
World.EnableTrigger "generosity_eq", FALSE
End Sub

Now, I've got two triggers with the pattern "You have recovered equilibrium", but the trigger that calls the subroutine "generosity_on_eq" doesn't fire..

If you could help me with this, thank you :D
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 08 Feb 2004 09:26 PM (UTC)
Message
If you want two triggers to match then you must check "keep evaluating" in the trigger dialog, otherwise MUSHclient stops when it first gets a match. This is deliberate, so you can put a "stopper" trigger in with an earlier sequence number.

If you have "keep evaluating" checked (in both) then the sequence won't matter.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Gore   (207 posts)  Bio
Date Reply #5 on Sun 08 Feb 2004 10:29 PM (UTC)
Message
Alright, can you explain any strongpoints to a "stopper" trigger and sequencing?
Top

Posted by Shadowfyr   USA  (1,790 posts)  Bio
Date Reply #6 on Mon 09 Feb 2004 02:42 AM (UTC)
Message
Hmm.. Hard to give an example, but say you are coloring text from a channel called gossip. However, you also want to color anything from 'Fred' a different color, so they stand out. You might do:

<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   group="channels"
   match="^([gossip]) Fred:(.*)"
   regexp="y"
   sequence="5"
   other_text_colour="orange"
   other_back_colour="black"
  >
  </trigger>
  <trigger
   custom_colour="17"
   enabled="y"
   group="channels"
   keep_evaluating="y"
   match="^([gossip])(.*)"
   regexp="y"
   sequence="6"
   other_text_colour="blue"
   other_back_colour="black"
  >
  </trigger>
</triggers>

Now, as to why. Triggers don't fire in any specific order, though they may execute in more or less the order created. It isn't predictable. So, lets say all of the ones above where set to sequence 100 and all used 'keep_evaluating="y"'. Lets call them 1 and 2 to make it easier. You could have any one of the following happen:

#1 is tested, it matches Fred, turns the line orange.
#2 matches and changes the color again to blue.

#2 matches, line becomes blue
#1 matches, line turns orange

Obviously only one of these works. By leaving the first trigger as the default setting of off of 'keep_evaluating', the first instance above would stop the line from instead turning blue. By changing the sequence so #1 will *always* happen first, you eliminate the cases where it may match on #2 first, then #1.

But this is not a major issue. Lets say you had a third trigger that turned all instances with the word 'poison' in them green or something.

<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   keep_evaluating="y"
   match="poison"
   regexp="y"
   sequence="7"
   other_text_colour="green"
   other_back_colour="black"
  >
  </trigger>
</triggers>

In this case if it matches *before* either the Fred trigger or the main channel trigger, then the word poison would never be colored. As soon as the Fred or main trigger hit, everything on the line would instantly turn orange or blue, including the word 'poison'. Now sequences become critical. Both of the prior triggers *must* allow the text to pass through 'keep_evaluating="y"', but the main gossip trigger *must* happen first. Why?

Fred matches (sequence 5) - turns orange.
Main matches (sequence 6) - turns blue.
Poison matches (sequence 7) - colors the word poison.

I this case while it would be nice to use a 'stopper', like the original Fred trigger above. Now you need the new poison trigger to work with both. Thus you have to change the sequences to work like:

Main matches (sequence 5) - turns blue.
Fred matches (sequence 6) - turns orange.
Poison matches (sequence 7) - colors the word poison.

It all depends on what you actually need to do. There are times when you want a specific line to stop any further triggers, scripting, coloring, etc. from happening once detected. Other times the specific order they happen in is critical. Occationally things need to both happen in a specific order *and* have one of them stop anything else happening. I don't often use triggers that don't have keep evaluating set on, with the exception of maybe one case I actually need it. Most of the time, simply forcing things to happen in the proper order solves most issues.
Top

Posted by Gore   (207 posts)  Bio
Date Reply #7 on Mon 09 Feb 2004 03:05 AM (UTC)
Message
Alright, so can you have keep evaluating on and also have them sequence? Also, Can you have like, Trigger 1 sequenced to 1, then Trigger 2 sequenced to 50?
Top

Posted by Shadowfyr   USA  (1,790 posts)  Bio
Date Reply #8 on Mon 09 Feb 2004 05:15 PM (UTC)
Message
Yes. I am not sure what the limit on sequences are, but I have ones ranging from 0 to 700. In some case I am even using the number just to place associated triggers in the same place in the list, since it will sort them by sequence. I kind of wish it did that by group first though. The only thing that matters with sequence is what order you want them to execute in, not the actual numbers.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #9 on Mon 09 Feb 2004 08:21 PM (UTC)
Message
Stopper triggers? Well you might be collecting a WHO list, for instance with a trigger that matches everything (*) but need another trigger first to detect the end of the list (eg. * players connected).

Thus the stopper trigger should fire first.

As for sequence numbers, they can be in the range 0 to 10,000.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #10 on Mon 09 Feb 2004 08:22 PM (UTC)
Message
Quote:

Alright, so can you have keep evaluating on and also have them sequence?


Yes, that is one of the reasons for sequencing, so they are evaluated in the *correct* sequence.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Gore   (207 posts)  Bio
Date Reply #11 on Mon 09 Feb 2004 10:40 PM (UTC)
Message
Nice, thanks a lot Nick :D
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.


28,174 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.