5/24/2023 0 Comments Mudlet trigger examples![]() Is that correct? Geyser.Label:new(), for example, seems to behave similarly to instantiating a class in python, and I'm assuming that's how we're meant to do that kind of thing? Out of curiosity, comparing classes in python to metatables in lua - metatables can be used to achieve a similar result, even though they aren't strictly the same thing. I can't imagine WHY I'd need to do those things that way yet, but that's not the point Create events on changes to specific gmcp data there is not already events for.manage sipping, if we did not have server-side sipping.I tried to wrap my head around metatables a few years ago, and failed, but that article makes a lot of sense so I'm going to revisit them now. If I were to do a single prompt trigger, and then a series of if statements, would that result in the same or better performance? Or is that something I should try and benchmark myself?Ī nice article on tracking with metatables, Keneanung, thanks. ![]() I'm a little sad to hear about the lower performance of function type triggers. I'd suggest you ditch the triggers entirely and use a timer that runs on a short interval - you could probably get away with once every second, though could likely make it faster than that without a noticeable effect on performance (I'm just not sure it would be necessary) - and checks all of the settings you're interested in against previously stored values, updating buttons as required. Using individual Lua function triggers for every option you care about is also going to be a scalability nightmare. It's possible for tables - as mentioned by Keneanung - but you'll quickly run into the issue that a lot of script authors for Achaea don't understand tables, and therefore don't use namespacing (the original version of Wundersys had this problem). If the check failed, the pattern failed and the trigger didn't execute its Monitoring Lua variables directly isn't possible. Just in that case the check being run on every line of output was "Is this line a prompt?" If the check succeeded, the pattern passed and the trigger executed its code. Huh, does this trigger setup fire without the need to fire off prompt? I’ve never seen code done like that.Technically you have, since every prompt trigger prior to Mudlet 3.6 (and the addition of the separate "prompt" trigger type) used the Lua function type. I've tried various connotations of 'return testvar', such asĪlso, my testing has been with a single pattern, forgetting the OR part - figured I should get a single one working first. If I can get the above to work, then I can use more complex expressions as well, and easily monitor how/what these other scripts are doing. The actual script will set the CSS of a label, giving me a toggle style button that displays some information, without requiring me to delve into someone else's code (say I am using wsys, svof or trex - at the moment I am leaning more toward wsys for its simplicity). this is an OR type trigger)Script:echo(tostring(testvar)) Pattern 1, lua func type: return testvarPattern 2, lua func type: return not testvarTrig options: default (i.e. ![]() ![]() True/False, running the triggers script when there is a change in the value. The mudlet manual is pretty vague when it discusses them. It's been too long since I used these, and I can't get them to work beyond just the basics, and I can't find any of my old scripts that did it.
0 Comments
Leave a Reply. |