Using multi-line filter triggers Instead of using enableTrigger disableTrigger
Let's say you want to put all hedge clippings from your inventory in a bag.
trigger: a few clippings from a hedge --beginning of substring match
or u could do...^a few clippings from a hedge(\s?)(\[?)(\d?)(\d?)(\]?)$ --regex
script: send("put clippings bag")
But now when you look in a container and it contains hedge clippings the trigger will fire.
So we need to tell it to only trigger if the item follows the line "You are carrying:"
One way to do this is to disableTrigger("trigger group name") on "carried:" (means it's a container) and set a tempTimer(2, [[enableTrigger("trigger group name")]] ). Then the trigger for the put should be disabled for two seconds while you receive the container contents.
However, it's buggy as hell. The triggers will get stuck in the off position.
This is pointed out in the mudlet manual:
..trigger chains are a means to automatically enable/disable trigger groups without the hassle of enabling and disabling trigger groups manually. This has 2 important advantages: Chains are faster than conventional solutions and chains reduce the complexity of your scripts and greatly reduce the usual system bugs that inevitably go along with
enable/disable trigger xy function calls as it’s very difficult and error prone to enable and disable your triggers correctly in large complex trigger systems. This is one of the most powerful features in Mudlet and should be used whenever possible.
So to accomplish the same thing with a filter chain:
In some folder (maybe "inventory") make a subfolder "carrying in inventory" now you make the trigger on the folder item itself (not a new item).
trigger: You are carrying (begin of line substring)
script: none
set fire length (the pink box in upper right) to 20 or 30 or so (the number of lines to check for matches following the trigger line)
Now make a new item (not folder) under that subgroup "carrying in inventory" and make a trigger "clippings"
trigger:a few clippings from a hedge (begin of line substring or make it into a regex pattern)
script:send("put clippings bag")
Done. Now only clippings that are in your inventory will trigger a match, not in containers, without the bugs associated with enabling and disabling trigger groups.
You can further chain trigger groups as well. Instead of making the trigger for clippings, you could add another subgroup to further test the trigger.
For example you could make a trigger than only fires if the item is in your inventory and then only fires if it contains the word dust and then only fires if it contains the words emerald or diamond and then places the dust in brewNameBag or whatever. This filter chain would consist of 3 nested trigger groups.
Of course with the large amount of items you'll be handling it would make more sense to make databases and use them within the triggers so that if the item is in inventory and element of wantedCps database, check to see which brew it goes to and put it in the appropriate container. Likewise you can create databases this way to track your inventory, container contents, etc...
But I haven't gotten that far yet. By the way, DONT USE THE MUDLET MANUAL DATABASE EXAMPLES UNTIL YOU INSTALL THE FIX POSTED TO THE MUDLET FORUM BY VASU. IT DOESN'T WORK WITHOUT IT
