PDA

View Full Version : Dynamically Set Button Icons



damned
November 18th, 2016, 12:12
Ok so I have a new feature almost ready to implement in MoreCore but I really think this little tweak makes a big difference.

So I can roll rolls (/die /rolld /success /pbta etc), tables (/rollon) and add modifiers (/mod) now from the MoreCore Character and NPC sheets. I think this really expands the usefulness again. What I almost have working is to have different buttons for each of those broad categories (rolls, tables, modifiers and another called chat). When creating/editing them it will automatically assign the right button in the detail view but you dont roll from the detail view you roll from a list on your character sheet.

I used a button_iconcycler to achieve the dynamically changing button but I need to change the behaviour of the onClick (actually its the onClickRelease) to not cycle to the next Icon but to execute the roll/command like the button_roll does... unfortunately button_roll uses an internal template/command called buttoncontrol so I cant snafu the code from there....

Sooooo.... I am looking to either change the onClickRelease for a button_iconcycler or find out how to dynamically set the icon for a button_roll...

Anyone got any suggestions?

damned
November 18th, 2016, 13:54
Just to give you a better idea of what Im talking about...

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=16451&d=1479477228

This lets you have Rolls and Modifiers in the same sections and you can identify which is which based on the icons. And Tables too of course.
You could click on Business Connections to add the +1 Modifier and then click on Investigate to make the Roll which would be /pbta 2d6 Investigate +1 Business Connections and it would roll and report everything.

Trenloe
November 18th, 2016, 17:48
How about returning "true" at the end of your onClickRelease function when you don't want the cycler code to work? See the "return values" here: https://www.fantasygrounds.com/refdoc/windowcontrol.xcp#onClickRelease

Talyn
November 18th, 2016, 20:54
Just curious, when you input a dice string into the textbox, is the / actually required to make it work? Obviously typing in the chatbox it would, that's how FG knows it's a command.

Just thinking way back to my mIRC helpdesk days, where scripts didn't need the / to execute the commands. :)

damned
November 18th, 2016, 21:19
Just curious, when you input a dice string into the textbox, is the / actually required to make it work? Obviously typing in the chatbox it would, that's how FG knows it's a command.

Just thinking way back to my mIRC helpdesk days, where scripts didn't need the / to execute the commands. :)

Yes it is required. The only thing that isnt required is any Description tags as we use the Roll Name as the description where that is supported.

damned
November 18th, 2016, 21:42
How about returning "true" at the end of your onClickRelease function when you don't want the cycler code to work? See the "return values" here: https://www.fantasygrounds.com/refdoc/windowcontrol.xcp#onClickRelease

Unfortunately changing this value seems to disable the button also.
Im going to have to leave it as a normal button and work out something else I think.