Scripting triggers on and off?

Posted by Gamoneterik on Fri 12 Mar 2010 12:10 PM — 8 posts, 32,111 views.

#0
Using VBscript (or some other way?), is there a way to turn MUSHclient triggers on and off?


-more info-
I play Achaea and the health regenerating system is "SIP HEALTH" but only when it says "You may now drink another health or mana elixir." It's dead easy to set up a trigger to SIP HEALTH everytime the above message pops up, but I wan't to be able to quickly (ie. from the command window) turn the trigger on and off, as I obviously don't want to keep sipping health elixirs once my health has regenerated, or I've stopped fighting, whatever.

I have just started using VBscript in MUSHclient but any way to help out with this would be great.

Cheers
-Gamoneterik
#1
just to be clear, i know there's an "enable trigger" box in configurations but i really need a way to just do it from the command line.
Australia Forum Administrator #2
Template:function=EnableTrigger
EnableTrigger

The documentation for the EnableTrigger script function is available online. It is also in the MUSHclient help file.



Make an alias that does "send to script" and calls that.

However personally I would automate it. That is, work out from your prompt whether you need to drink it in the first place.
#3
I'm very new to scripting, the subroutines in my script file look like this:

sub SipHealth
world.EnableTrigger "siphealth", TRUE
end sub

sub SipHealthOff
world.EnableTrigger "siphealth", FALSE
end sub

and I have simply labelled the trigger I want as "siphealth"

I have set up the alias, labelled sip_health, to call the script, but when i use the alias i get the error message:

"Wrong number of arguments for script subroutine "SipHealth" when processing alias "sip_health"
We expected your subroutine to have 3 arguments"

...

sorry, I'm a bit of a noob. If you could shed some light on this it would be great. Thanks in advance.
USA #4
Gamoneterik said:
sub SipHealth
world.EnableTrigger "siphealth", TRUE
end sub

sub SipHealthOff
world.EnableTrigger "siphealth", FALSE
end sub


I think, since you're using VBScript, you need to declare the three arguments that alias callback functions are supposed to have:

sub SipHealth(name, line, matches)
  world.EnableTrigger "siphealth", TRUE
end sub

sub SipHealthOff(name, line, matches)
  world.EnableTrigger "siphealth", FALSE
end sub
Australia Forum Administrator #5
He's right, plus in VB in it vbTrue and vbFalse, from memory. You can't just use TRUE and FALSE.
Australia Forum Administrator #6
I take that comment back, you got TRUE and FALSE from the documentation, and it seems to work. Just add the arguments to the trigger and that should do it, or do it inline, like this:


<aliases>
  <alias
   match="sip health on"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
EnableTrigger "siphealth", TRUE
Note "Health trigger turned on"
</send>
  </alias>
</aliases>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

#7
Fantastic! It works now. Thank you so much guys :)