Trigger Help

Posted by Malek on Sat 19 Aug 2006 07:31 PM — 23 posts, 80,341 views.

USA #0
This is a fairly simple question, Really upsets me I can't get something this simple to work.
Here's the deal...
I am trying to get mush to trigger from the promt on my name.
Malek doesn't look so great. (is what I need triggered)
I have tried it as - Malek doesn't look so *
^Malek doesn't look so great\.$
Malek doesn't look so great.

once I get it to trigger on that exact phrase from the mud prompt. I then need it to send a alias command as a response to the mud..

The alias command would be - flask1,flask2,bota

Ifsomeone could help me take care of this simple yet aggrivating issue I am having here I would greatly appreciate it.
#1
The problem is not the matched text, it is in where the trigger sends the result. You should set 'Send To:=Execute' in the trigger dialogue to have the results sent via the command line. The command line evaluates alias'. 'Send To:=World' just sends the text in the send box to the MUD.

You can test to see if a trigger fired by sending fake input to MUSHclient. Menu "Game->Test Trigger". You could also set trace on via "Game->Trace".

<triggers>
<trigger
enabled="y"
match="^Malek doesn't look so great\.$"
regexp="y"
send_to="10"
sequence="100"
>
<send>flask1
flask2
bota</send>
</trigger>
</triggers>
Amended on Sat 19 Aug 2006 09:57 PM by Renquist
Australia Forum Administrator #2
What is the problem? The trigger isn't firing? Or you can't send the stuff you want?

Can you post the actual trigger you used?

See:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4776

Then post the exact line you received from the MUD. Based on what you described above it should have worked.

However if the line you actually received is:

<100h 200mv 300m> Malek doesn't look so great.

Then it will not fire, because the line starts with extra stuff.
Amended on Sat 19 Aug 2006 09:56 PM by Nick Gammon
USA #3
The Line I need triggered is this:
Malek doesn't look so great.
The trigger I have set is this:
^Malek doesn\'t look so great\.$
The trigger is sending to mud a set of aliases I have made named FLASK1 and FLASK2 and BOTA. Which is really notwhat I intend to do once I learn how to make scripts.. I would eventualyl like it in Lua script to run FLASK1 only if FLASK1 is in my cloak..
Else run the FLASK2 alias from the pack...
If neither are there then to run the BOTA alias.
As you probably can tell I have no damned clue what I am doing yet until recently I typed all my commands in via Telnet as I went.. if one could help me write a code for it the that would be great..
If it helps the hp and ep on this game shows up as:
HP:220 EP:220 (but not when you are shaped)
That simpley comes up as Malek doesn't look so great.
Australia Forum Administrator #4
Malek, it will help me to assist you if you answer my questions. Did the trigger match, or not? If you edit the trigger you will see (about half-way down) "0 matches" or maybe "5 matches". That will tell if it is matching.

I asked you to show me the actual trigger, I expect some XML code like Renquist posted in his reply.

Renquist is right, if the trigger is supposed to send aliases, then you need to set the "send to" field to "execute", otherwise it just sends the words "flask1" etc. to the MUD. However it is hard to tell exactly what you are doing until you post the actual trigger. Follow the link I gave for how to do that.
USA #5
Opps sorry :)

this is the trigger:
<triggers>
<trigger
enabled="y"
match="^Malek doesn\'t look so great\.$"
sequence="100"
>
<send>flask1</send>
</trigger>
</triggers>

I see no matches and the output is to the world.
The send flask1 is a preset alias that sends:
do get flask from cloak,open flask,drink flask,close flask,put flask into cloak
Australia Forum Administrator #6
OK, that trigger looks like a regular expression, but you don't have regexp checked. Either make it "normal" like this:

match="Malek doesn't look so great."

or, check the "regular expression" checkbox.
USA #7
Regular expression checked now... Still will not fire any other suggestions?

<triggers>
<trigger
enabled="y"
match="^Malek doesn\'t look so great\.$"
regexp="y"
sequence="100"
>
<send>flask1</send>
</trigger>
</triggers>

Also tried it like this...

<triggers>
<trigger
enabled="y"
match="Malek doesn't look so great."
sequence="100"
>
<send>flask1</send>
</trigger>
</triggers>

Still nothing...
Australia Forum Administrator #8
Hmmm - can you copy and paste the text from the MUD that is supposed to trigger it? With a couple of the surrounding lines too please. Don't retype it, copy directly from the output window.

I suspect there is a space there somewhere.
USA #9
had to go get beat up for this :)

do shape all here
Do: starting commands.
HP:106 EP:213>
Malek doesn't look so great.
-------------------------Malek DOESN'T LOOK SO GREAT-------------------------
Troll is in average shape.
-------------------------Troll in AVG SHAPE-------------------------
HP:106 EP:213>
Do: Commands completed.
HP:106 EP:213>
Australia Forum Administrator #10
I tried that and your trigger worked. I copied and pasted into Game menu -> Test Trigger (Shift+Ctrl+F12) and the trigger fired.

In your trigger list (the list of all triggers) do you have "Enable Triggers" checked? Try setting a colour for the match so you can see if it matches visually. Also if "flask1" is an alias then you should send to Execute and not World. This is what I had in the end:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="Malek doesn't look so great."
   send_to="10"
   sequence="100"
  >
  <send>flask1</send>
  </trigger>
</triggers>

Australia Forum Administrator #11
Ah, and where does this come from ...


-------------------------Malek DOESN'T LOOK SO GREAT-------------------------


Is that another trigger?

If so, each trigger should have "keep evaluating" checked, or only the first matching trigger is processed. If you want to have the same line trigger multiple triggers you need "keep evaluating".
Amended on Sun 20 Aug 2006 01:21 AM by Nick Gammon
USA #12
Ok I checked to make sure that all triggers were enabled on my triggers list. (Enable Triggers is checked. I also set a color match.. RED on RED and custom color #7

<triggers>
<trigger
back_colour="9"
custom_colour="7"
enabled="y"
match="Malek doesn't look so great."
match_back_colour="y"
match_text_colour="y"
send_to="10"
sequence="100"
text_colour="9"
>
<send>flask1</send>
</trigger>
</triggers>

Still nothing.
Australia Forum Administrator #13
What about my other question? Does another trigger also match that line?
USA #14
Missed that question earlier..
Yes this is another trigger used to quickly and noticably report the shape of who I shape.. Trigger is as follows

<triggers>
<trigger
custom_colour="7"
enabled="y"
keep_evaluating="y"
match="* doesn't look so great."
send_to="2"
sequence="100"
>
<send>-------------------------%1 DOESN'T LOOK SO GREAT-------------------------</send>
</trigger>
</triggers>
USA #15
I figured it out.. Due to my shaping triggers not being in Regular expression it was as you said trying to evaluate both sets of triggers at the same time.. I converted my shaping triggers into Regular Expressions and now everything works like a charm... Thanks for your help and time.
Australia Forum Administrator #16
Quote:

... RED on RED and custom color #7 ...


Why do that? Surely the line from the MUD is not red text on a red background? You wouldn't be able to read it.
USA #17
no.. I was just trying anything and everything.. But I got it working now and everything is working as it should.. Now to just start figuring out how to run scripts that will use flask1 if it's there. Else flask2 if flask1 is not there. Else bota is flask1 and 2 are not there..
USA #18
I do have one more question though.

I there a way to enable a certain trigger by using a command?
Such as by typing a command or perhaps when another trigger is fired?
Australia Forum Administrator #19
http://www.gammon.com.au/scripts/doc.php?function=EnableTrigger
USA #20
Based upon what I saw in that file if I set it like this

world.EnableTrigger "Backstabs", TRUE ' enable pk
world.EnableTrigger "Backstabs", FALSE ' disable pk

(pk) being the trigger label.. it would automaticlly enable and disable correct?

If so is there a script one could write to enable it by typing
(pk on) and disable by typing (pk off)?
Australia Forum Administrator #21
If "pk" is the label of the trigger, then you need:

EnableTrigger ("pk", true) --> enable pk trigger

You can make an alias to do that for you. I will assume you have set up Lua as the scripting language and turned scripting on:


<aliases>
  <alias
   match="pk on"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger ("pk", true)
ColourNote ("white", "brown", "PK turned on")
</send>
  </alias>
</aliases>


A similar one would turn the trigger off (change "true" to "false").
USA #22
Nick,
You have been a very big help.. I appreciate it more then I can say.. Everything is working great and my client is now alot better then it was when I started. It's almost BOT like in pk mode now.. only thing I have to do is type (sh) to stay alive during pk attempts now.. Well that and my profession commands.. Thank you once again for all your help.