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
➜ Suggestions
➜ Can MUSHclient support sub-group definition?
|
Can MUSHclient support sub-group definition?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Zhenzh
China (68 posts) Bio
|
| Date
| Thu 05 Sep 2019 06:30 AM (UTC) |
| Message
| Too many triggers under one group and too many groups get the trigger difficult to be read and managed.
If sub-group can be supported, triggers can be managed as file trees which will be helpful for understanding and controlling the trigger relationships. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sat 07 Sep 2019 11:25 PM (UTC) Amended on Sat 07 Sep 2019 11:26 PM (UTC) by Nick Gammon
|
| Message
| No it doesn't.
However if you have many triggers there are ways of dealing with them.
Filter the trigger view
In the filter dialog there is a checkbox "Filter by" and a button labelled "...".
If you click on the "..." button you can make a filter script, for example:
local wanted_group = utils.inputbox ("Choose group", "Group", "")
function filter (name, trigger)
if not wanted_group or wanted_group == "" then
return true
end -- if no response
return trigger.group == wanted_group
end -- filter
The first line prompts you for a group you are interested in, and then for each triggger line item the function "filter" is called which returns true if you want to see that line and false if you don't.
Now you can click on the checkbox and you will be prompted for a group, and then only items in the group will be shown. You could make a partial match by using string.match rather than compare-equal in the filter function.
This can be useful for cutting down large lists in a way of your choosing. A more sophisticated function could query for things like enabled triggers, triggers which have never fired, triggers which send-to-script and so on.
Move the triggers into plugins
Instead of doing everthing in the GUI interface you can make one or more plugins which lets you move batches of triggers which do related things, into a plugin. Whilst you cannot edit the triggers in a GUI dialog any more, the text version is quite easy to follow. For example:
<triggers>
<trigger
enabled="y"
match="Affects * by *."
name="affects"
send_to="12"
sequence="100"
>
<send>
objectStats ["%1"] = "%2"
EnableTrigger ("end_of_affects", true)
</send>
</trigger>
</triggers>
It is pretty obvious what is going on in this trigger. You can see the match text, the trigger name, and what it is sending to script.
In a plugin XML file you can add comments to make it obvious what groups of triggers do, for example:
<!-- Triggers for getting my inventory -->
If you were keen you could make your own program (eg. in Python or C++) to edit these XML files, find the triggers and display them in a tree view. The plugin files can be parsed by any standard XML parser. |
- 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.
11,982 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top