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 ➜ Triggering a trigger? How to make an alias that can turn a trigger off and on.

Triggering a trigger? How to make an alias that can turn a trigger off and on.

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


Posted by Jeremymia   (5 posts)  Bio
Date Sat 11 Feb 2006 03:09 AM (UTC)
Message
I'd like the following trigger:
Trigger:You remove * gold from a sailor's kitbag.
Response: put %1 gold in pack

However, this is very bad for when i'm shopping. Instead of disabling in manually, is there a way for me to type something like "Shopping", or, if necessary "Shopping on" and "shopping off" to avoid this?
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 11 Feb 2006 03:49 AM (UTC)
Message
Name your trigger "shopping" (put that word in the "label" field). Then this alias will do it, if you have Lua as the script language.


<aliases>
  <alias
   match="shopping"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
if GetTriggerInfo ("shopping", 8) then
  EnableTrigger ("shopping", false)
  ColourNote ("black", "yellow", "Shopping trigger turned off")
else
  EnableTrigger ("shopping", true)
  ColourNote ("white", "blue", "Shopping trigger turned on")
end -- if
</send>
  </alias>
</aliases>



Basically it sees if the trigger is enabled, and if so, turns it off (disables) it, otherwise it enables it. Type "shopping" to make the alias do its stuff.

- Nick Gammon

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

Posted by Jeremymia   (5 posts)  Bio
Date Reply #2 on Sun 12 Feb 2006 01:40 AM (UTC)
Message
Thank you, but I still don't know how to do this.

For one, I've never used the script thing of mushclient before, so i'm not sure how to do it - I imagine the copy the code into notepad and save it as whatever.lua, though. Then you go to script, select lua, and select the script there. However, this doesn't work. (Some error about a >)

Second, what room does this leave me to declare the parameters of the trigger I want? Namely, the one where "You remove * gold from a sailor's kitbag" should result in "put %1 gold in kitbag." If I name the trigger shopping, I clearly can't name it "You remove * gold from a sailor's kitbag."

I have read the scripting overview. Sorry...
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 12 Feb 2006 03:32 AM (UTC)

Amended on Sun 12 Feb 2006 03:34 AM (UTC) by Nick Gammon

Message
Quote:

I imagine the copy the code into notepad and save it as whatever.lua, though


It is easier than that. See this post:

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

Just make sure you have Lua as the script language, and enabled. You don't need a script file in this case.

Quote:

Second, what room does this leave me to declare the parameters of the trigger I want?


This is an alias that turns the trigger on and off. You still have the trigger, like you described, and put "shopping" in the Label field.

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


15,772 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.