Clickable buttons and stuff.

Post Reply
Aquifn
Posts: 19
Joined: Fri Mar 15, 2013 8:37 pm

Clickable buttons and stuff.

Post by Aquifn »

So, I want to set up an alias that gives me a list of possible defenses. I want the defenses, to have two states. Active, and unactive. And I want to be able to click the name I give the defense, to activate them.

I'm pretty sure I can do most of it, what I've never been able to successfully do is the clickable button. And maybe showing active vs unactive in quick easy code rather then long drawn out.


So basically, hit alias command and see [Deathslight] as either faded (not active) or bold (active). And clickable to send commands.

xabre
Posts: 45
Joined: Thu Mar 08, 2012 7:19 pm

Re: Clickable buttons and stuff.

Post by xabre »

I use Geyser labels for that, label stylesheet (mostly background image) changing based on state of the button, and action set with setClickCallback. Mabye someone knows more sophisticated way, but heck, it works.

User avatar
SlySven
Posts: 994
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Clickable buttons and stuff.

Post by SlySven »

Do you mean "Alias" or "Button" - I've been looking over the current "Buttons" code and there are one or two things that I think could work better but if you set a button created in the editor (probably has to be in a "group"/"folder" which become a dockable widget Toolbar) to be a "push down" Button you can retrieve the button state IN THE SCRIPT AREA FOR THAT BUTTON ONLY with the getButtonState() lua call which will return 2 if the button is ON and 1 otherwise. :geek:

At present there does not appear to be a way to query the button state otherwise, to change the button state or enable or disable it with Lua code and there is not currently a way to put an icon (picture) on the button, though there are code remnants that suggest it was once possible. Enabling/Disabling a button in the editor shows/hides the button in the toolbar and if you set there to be more than one row or column (toolbar orientation dependent as to which that folder/group property applies) the layout is not stable or easy to plan out as it get redrawn every time something changes in the editor and includes at least one dummy button-sized space before the first button lines them up weirdly particularly if the toolbar is not docked. :ugeek:

I have played around with this and got something that meant I could, say (using the Oxygen "Emotes" 48px Icons) have a smiling face icon if the button was down or a sad one if it was up or a greyed out plain one if it was disabled and I think it would have been possible to do C++/Lua interface code to both query and control the state from a general lua script but I realise - like xabre has already pointed out - that the same things can already be done (somehow) with Geyser (and presumable Vyzor) labels... {and multiple state related icons would be incompatible with the current file format - and extending that in a "compatible" manner would cause all but one to be lost from the profile if an "extended" was loaded and then saved from an older Mudlet instance that did not understand the extra icons.} :(

Post Reply