[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Scripting triggers on and off?

Scripting triggers on and off?

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


Posted by Gamoneterik   (5 posts)  [Biography] bio
Date Fri 12 Mar 2010 12:10 PM (UTC)
Message
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
[Go to top] top

Posted by Gamoneterik   (5 posts)  [Biography] bio
Date Reply #1 on Fri 12 Mar 2010 12:12 PM (UTC)
Message
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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 12 Mar 2010 07:22 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Gamoneterik   (5 posts)  [Biography] bio
Date Reply #3 on Sat 13 Mar 2010 01:54 PM (UTC)
Message
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.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #4 on Sat 13 Mar 2010 05:21 PM (UTC)
Message
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

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sat 13 Mar 2010 07:29 PM (UTC)
Message
He's right, plus in VB in it vbTrue and vbFalse, from memory. You can't just use TRUE and FALSE.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sat 13 Mar 2010 07:33 PM (UTC)
Message
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.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Gamoneterik   (5 posts)  [Biography] bio
Date Reply #7 on Sun 14 Mar 2010 01:16 PM (UTC)
Message
Fantastic! It works now. Thank you so much guys :)
[Go to top] 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.


19,355 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]