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 ➜ Tips and tricks ➜ Suggestions for triggers

Suggestions for triggers

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


Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Sun 04 Mar 2001 04:17 PM (UTC)
Message
Triggers can greatly simplify playing a MUD by reacting automatically to incoming text.

You can use them to :

* Colour text (eg. chat channels)
* Highlight words (eg. your name)
* Gag annoying players
* Play sounds
* Automatically send something to the MUD
* ... and more ...

For greater detail, see the page:

http://www.gammon.com.au/mushclient/funwithtriggers.htm



Examples

Respond to events

Match on: You have been idle, and are pulled into a void.
Send: look

Match on: You are thirsty.
Send: drink water

Match on: You are hungry.
Send: eat food

Match on: You collapse, totally out of breath!
Send: stand

Match on: You fall down.
Send: stand

Gag trivial messages

Match on: * dodges
Omit from output: checked

Match on: * misses
Omit from output: checked

Match on: You dodge
Omit from output: checked

Match on: You parry
Omit from output: checked


- Nick Gammon

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

Posted by Gialynn   (4 posts)  Bio
Date Reply #1 on Fri 06 Apr 2001 01:33 AM (UTC)

Amended on Fri 06 Apr 2001 01:34 AM (UTC) by Gialynn

Message
so.. i don't get it... (taps her blonde ponytail)
what's the syntax you use for highlighting strings?
I haven't been able to get it to work yet...
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 06 Apr 2001 01:48 AM (UTC)

Amended on Fri 06 Apr 2001 01:49 AM (UTC) by Nick Gammon

Message
OK, let's say you want to hilight the word "Gialynn" whenever it appears.

1. Go to Configuration -> Appearance -> Triggers.

2. Add a new trigger

3. Enter the following fields:

Trigger: Gialynn
Regular Expression: checked
Change colour and style to: Custom1

Leave the rest alone.

4. Click OK to add the trigger.

5. Click OK to dismiss the configuration dialog.

Now try sending a message with that name in it, and it should be highlighted. If you don't like the colour, go to Configuration -> Appearance -> Custom Colour, click on the swatch for Custom1, and change the colour (text colour, and background colour are separate swatches).


- Nick Gammon

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

Posted by Robert Mituniewicz   (5 posts)  Bio
Date Reply #3 on Mon 09 Apr 2001 03:35 PM (UTC)
Message
Is there a way to change sequnce number in trigger by script?
Or turn off/on echoing commands by script?

____
Robert Mituniewicz
Top

Posted by Gialynn   (4 posts)  Bio
Date Reply #4 on Mon 09 Apr 2001 09:09 PM (UTC)

Amended on Mon 09 Apr 2001 10:21 PM (UTC) by Gialynn

Message
ok... got the trigger setup for single line things down....

Now...

the MUD I play has a 2 type ahead limit... I want to do a
few three and 4 line macros and triggers... is there some
kind of 'pause' I can enter in that will make the macro and/or
trigger wait a second or two before sending the next command?

also.. the button at the bottom (the 'save' button) should
say 'SEND', not save, since when pressing it, the message is
SENT to you, not saved to my 'puter...

i know..i'm picky...but i'm a blonde...and a Yank...
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Mon 09 Apr 2001 10:10 PM (UTC)
Message
Quote:

Is there a way to change sequnce number in trigger by script?
Or turn off/on echoing commands by script?


At this stage I think that triggers are added with the default sequence number of 100. All I can suggest is to make the other ones above/below the ones added by the trigger.

As for turning on/off echoing commands - not at present, however I have added that as suggestion #393.


- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Mon 09 Apr 2001 10:15 PM (UTC)

Amended on Mon 09 Apr 2001 10:24 PM (UTC) by Nick Gammon

Message
Quote:

the MUD I play has a 2 type ahead limit... I want to do a
few three and 4 line macros and triggers... is there some
kind of 'pause' I can enter in that will make the macro and/or trigger wait a second or two before sending the next command?


To do this you could make your trigger "Send to world (speedwalk delay)" and make the speedwalk delay the number of seconds you want.

There isn't a similar thing for macros, however you could make an alias which matches on whatever you want to send, and the alias can call a script, and in the script you can make it "Queue" the command (which sends it at the speedwalk delay). However I have added the idea of making that an option on a macro (delayed sending) as suggestion #394.

Quote:

also.. the button at the bottom (the 'save' button) should
say 'SEND', not save, since when pressing it, the message is SENT to you, not saved to my 'puter...


Ah, the button at the bottom of what?

- Nick Gammon

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

Posted by Brett McLennan   (9 posts)  Bio
Date Reply #7 on Wed 11 Apr 2001 02:44 PM (UTC)
Message
I think you should post on this site how to set up a tick timer and trigger. A straight timer won't work, cause its slightly randomn so it needs to by synced occasionally. If someone could do this it would help out us newbies greatly.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Wed 11 Apr 2001 10:03 PM (UTC)
Message
Can you post an example of what you see when the tick timer needs to be synced? Just copy and paste from the output window in MUSHclient for accuracy.

Also mention the rough period for the tick, and I'll try to do the examples you mention.

- Nick Gammon

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

Posted by Brett McLennan   (9 posts)  Bio
Date Reply #9 on Wed 11 Apr 2001 10:18 PM (UTC)
Message
A tick is between 58 and 62 seconds, its randomn by about 2 seconds.
Things that could sync it are:
Darkness marks the end of another day.
It starts to rain.
Thunder announces the beginning of the storm.
With your studies complete, you close your spellbook


If you could explain this in detail that would be greatly appreciated.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #10 on Wed 11 Apr 2001 11:18 PM (UTC)
Message
OK, this sounds simple enough ...

Make the timer

First, make a timer by using the timer configuration screen ...

File menu -> World Properties -> General -> Timers

1. Click on "Add"
2. On the first line (Every interval) type "60" into the seconds box
3. It depends a bit on what you want to do with the ticks, but for now enter "think tick", or something like that, into the "send" box.
4. Enter "tick_timer" into the "label" box. This gives the timer a name.

Synchronise the timer

Now you need a trigger that will synchronise the timer to allow for its randomness.

Make a trigger by using the trigger configuration screen ...

File menu -> World Properties -> Appearance -> Triggers

1. Click on "Add".
2. Fill in the following fields:


Trigger: ^(Darkness marks the end of another day.|It starts to rain.|Thunder announces the beginning of the storm.|With your studies complete, you close your spellbook.)$

Send: Tick synchronised.

Send to: Output

Regular Expression: checked

Label: tick_trigger

Script: OnTickTrigger



What this will do is use a regular expression to check on one of your various messages (the "|" is an "or" symbol, so it means "this" or "that").

The message must be spelt exactly correctly or it won't match. Preferably copy and paste a genuine one. Even a missing period at the end will stop it matching.

The trigger will echo "Tick synchronised." to the output window (so you can see that the trigger has matched). You can omit that if it is annoying.

The trigger also calls a script subroutine "OnTickTrigger". You must put this into your script file. Here is an example in VBscript and JScript:

VBscript


sub OnTickTrigger(strTriggerName, strTriggerLine, arrWildCards)
world.ResetTimer "tick_timer"
end sub



Jscript


function OnTickTrigger(strTriggerName, strTriggerLine, wildcardsVB)
{
world.ResetTimer("tick_timer");
}



You could add these to the end of the exampscript files supplied with MUSHclient, or just paste them into a separate file (using the notepad).

Make sure scripting is enabled, the appropriate language is selected, and that this file is selected as the script file.

The net effect will be that when the trigger fires, the timer will "reset" which means it will start counting from zero again. This will wipe out the cumulative effect of the random seconds.

Have fun.


- 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.


41,935 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.