View Full Version : Reading XML files from LUA
joshuha
December 3rd, 2008, 20:42
I know a control can access it's own XML tags (https://www.fantasygrounds.com/modguide/scripting.xcp) and I have used this before but is it possible to read in XML tags from other objects like framedefs, font declarations, etc.?
Since these are special objects that don't have onInit events or anything I can't thing of a way to self register the resource nor can I think of a way to access them from LUA from another control. What I want to do is show my user a list of fonts available or frames available but I cannot think of a way to access that information without hardcoding the data in. Of course with custom rulesets or graphics/fonts/etc. this doesn't help.
Anyone have any ideas?
Brenn
December 7th, 2008, 19:04
I don't. Been shooting down what few ideas I've had for the past 45 mins or so. That datastructure has to be present, obviously, but it's accessibility from script is the issue.
Bidmaron
December 8th, 2008, 00:27
Seems like the devs would chime in on this one, Josh.
Foen
December 8th, 2008, 06:12
I think the XML structures behind various ruleset elements (such as framedefs and fonts) are inaccessible from script. It isn't even possible to access some db.xml tags (such as the bitmap, gridsize and gridoffset tags in an image control).
If you want folks to be able to add fonts and frames to the dynamic character sheet Joshuha, perhaps the next best thing would be to expose a set of registration routines, and then allow extensions to supply them via a plug-in approach?
Stuart
Brenn
December 8th, 2008, 15:32
Another way to look at it is that, while a pain, one of the least complicated things to do is edit the font and frame defs. You could set up entries for custom items in both of those, put them at the top of the file then just give the info on editing them (though the names would have to stay static).
It would be nicer to do dynamically, but in the scope of things and what you are doing, it's not that big of an issue, IMO.
Bidmaron
December 9th, 2008, 02:52
I think it is a bigger deal than you think. Size of the font will affect the layout and design of the form. I think this is a show-stopper or a significant slow-her-downer.
Brenn
December 9th, 2008, 04:52
I think it is a bigger deal than you think. Size of the font will affect the layout and design of the form. I think this is a show-stopper or a significant slow-her-downer.
Regardless of how it is approached, the fonts will still have to be defined in bmpfonts.xml... It's just a matter if the names defined there are retrieved dynamically or are hard-coded. Doesn't seem like a show stopper to me, unless I'm missing something here.
Modification of the fonts (beyond color) is a 'slow-her-downer' (of sorts) in FG and I don't think there is currently any way to make it any less cumbersome. Not that big of a deal though considering that once you find the few fonts you are going to be using it is pretty much smooth sailing from there.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.