PDA

View Full Version : Creating windowclass controls with script



gnujak
June 19th, 2019, 23:59
Hi again, I would like to add the individual armour locations I have to the character sheet xml. I was wondering if I can do this with lua. I have the armour items scripted to add armour locations and values to the character database nodes when it is equipped, then delete those locations and values when you unequip them. I would like to scan the armour locations node and then create a control to display the values on the character sheet. Sometimes there may be a value for something like "hand" and sometimes not so I would like to display only the ones that have values in them at the time. I don't want to load up the database node with useless entries or the character sheet with stuff that doesn't matter. This is why I would like to use lua to create the controls dynamically. I think I saw something like this when I was looking stuff up but I can't seem to find it now. Thanks for the help.

Trenloe
June 20th, 2019, 04:26
For what you can do in FG LUA, look in the Developer API reference: https://www.fantasygrounds.com/refdoc/

To look for what API methods might be available for what you'd like to do, think of the FG API in terms of objects and then reference the object where you want to do something against. In this case, you want to create a control in a window. In this case, you want to look at windowinstance - the instance of the window created from a windowclass: https://www.fantasygrounds.com/refdoc/windowinstance.xcp

Then, you want to create a control, so look for something like createControl in the windowinstance interface: https://www.fantasygrounds.com/refdoc/windowinstance.xcp#createControl

Moon Wizard
June 20th, 2019, 23:46
In this case, I would probably just add all the controls onto the sheet in the correct positions, then show/hide them based on whether they are wearing the correct armor type. While it will create extra database nodes for each character, it seems like they would be manageable, and it would prevent having to dynamically add/remove controls.

Regards,
JPG