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 ➜ Tips and tricks ➜ Didnt know where else to ask, but its about triggers

Didnt know where else to ask, but its about triggers

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


Posted by Madrox   (40 posts)  Bio
Date Tue 13 Dec 2005 04:44 PM (UTC)
Message
Is there a way to make trigger groups? Say I have a set I use for one char, but dont want happening for a different char. Is it possible to group them, and disable them as a whole, rather than disableing each one by itself
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 13 Dec 2005 07:33 PM (UTC)
Message
Sure, that is what groups are for.

In each trigger, alias or timer that only applies to one group, put a group name in the "Group" box. It would be the same for each one that is related. That name could be your character name, for example.

Then you can type:


/EnableGroup ("abc", true) -- enable group "abc"


or


/EnableGroup ("abc", false) -- disable group "abc"


However a nice thing to do then would be to automate the whole thing. You can write a small script and make it be run when you connect to your character. Here is an example in Lua:


function OnWorldConnect ()
  if GetInfo (3) == "Madrox" then
    EnableGroup ("abc", true)
    Note "Enabling group 'abc'"
  else
    EnableGroup ("abc", false)
  end -- if
end -- function


Then put "OnWorldConnect" into the "World Events -> Connect" in the scripting configuration screen. This enables or disables the group depending on the character name in the "Connecting" configuration screen.




However if you type the character name in manually then you might simply need to ask whether or not to enable the group. Here is one way of doing that:


function OnWorldConnect ()
  local result = utils.msgbox ("Enable triggers for 'Madrox'?",
                               "Use special triggers", "yesno", "?")
  if result == "yes" then
    EnableGroup ("abc", true)
  else
    EnableGroup ("abc", false)
  end -- if
end -- function


This will display a small Windows dialog box whenever you connect, and enable or disable the group according to your response. Again, you need to put OnWorldConnect into the "world connect" event.




Another approach is to detect what character you have logged onto by detecting the usual "welcome" message with a trigger, and do the enabling then.


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="Welcome to Realms of Despair, *"
   send_to="12"
   sequence="100"
  >
  <send>
if "%1" == "Madrox" then
  EnableGroup ("abc", true)
  Note "Madrox triggers enabled."   
else
  EnableGroup ("abc", false)
  Note "Madrox triggers disabled."   
end -- if
</send>
  </trigger>
</triggers>


Of course, you need to customise this slightly to match your welcome message, if indeed you get one.




A different approach again is to have two different world files, one for each character.

- Nick Gammon

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

Posted by Madrox   (40 posts)  Bio
Date Reply #2 on Tue 13 Dec 2005 09:31 PM (UTC)
Message
Wow, thanks a lot :) I never noticed the GROUP option before. This is a major help.
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.


12,338 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.