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 ➜ Trigger based on whether or not a trigger is active

Trigger based on whether or not a trigger is active

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


Posted by ErockMahan   (81 posts)  Bio
Date Wed 14 Feb 2007 07:50 PM (UTC)
Message
To explain what I'm doing:

I want to set up a trigger that will go something like this:

(I send "attack beast")
Trigger activates - GetInfoAboutTrigger "punch" -
Is "punch" active?
If yes, send "punch"
If no, send ""
Is "kick" active?
If yes, send "kick"
If no, send ""


I know there is a real command that is the equivalent to "GetInfoAboutTrigger" (which I just made up, for those of you who don't know), but I haven't been able to figure it out at all.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #1 on Thu 15 Feb 2007 10:37 AM (UTC)

Amended on Thu 15 Feb 2007 10:38 AM (UTC) by Shaun Biggs

Message
http://www.gammon.com.au/scripts/function.php

The above link is a list of all the scripting functions of MUSHclient. It's an invaluable resource. As to how to use this, the next example is in Lua, but pick whatever language you are most comfortable with. Just put it in the send field, and make sure the "send to" selector is set to script. I personally would get rid of the send( "" ) parts.



if GetTriggerInfo( "punch", "enabled" ) == 1 then
  send( "punch" )
else
  send( "" )
end -- check for punch
if GetTriggerInfo( "kick", "enabled" ) == 1 then
  send( "kick" )
else
  send( "" )
end -- check for kick

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 16 Feb 2007 04:06 AM (UTC)
Message
Check out:

http://www.gammon.com.au/scripts/function.php?name=GetTriggerInfo


It is actually:


if GetTriggerInfo ( "punch", 8 ) then


The 2nd argument to GetTriggerInfo is a number.

You might have been thinking of GetTriggerOption, see:

http://www.gammon.com.au/scripts/function.php?name=GetTriggerOption

- Nick Gammon

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

Posted by ErockMahan   (81 posts)  Bio
Date Reply #3 on Fri 16 Feb 2007 02:56 PM (UTC)
Message
Yup, you got what I was after:

if GetTriggerInfo ("punch1", 8) = 1 then
send ("punch")
else
send ("")
end if

I may remove the 'else' part of that, but it works fine otherwise!
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.


14,862 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.