PDA

View Full Version : Programmatically get list of all framedefs?



celestian
February 5th, 2019, 06:28
Is it possible to get a list of all the framedefs programmatically?

I'm wanting to grab a list of all of them, build a list of all the reference-* versions and use it for a select option for frame use in Author in generated reference manual.

Bidmaron
February 6th, 2019, 04:46
Yes, but it will be a pain in the arse.
Download my Generators extension and look for the import logic. You can steal the code out of there to import all the framedefs from the xml files in the ruleset (which will have to be unpacked) in a way similar to how I handle import and export of generators bypassing the normal module method. The first time your user uses the tool, you will have to prompt him for every xml file (since there is no way to read a directory file in FG) in the ruleset or you will have to hard code the file names yourself. You can import into a temporary node like I do in Generators and then go parse the xml. Now, I haven't tried this, but I think it would work.

celestian
February 6th, 2019, 19:35
That's a bit further down the rabbit hole than I am trying to go unfortunately. I can't expect users to of Author to be able to do that. I'm hoping there is API access via LUA that allows me to see those variables. If I can do that then I'd be able to grab all the CoreRPG AND the ruleset running plus any theme they might have loaded.

If not my best bet is to just use the ones I KNOW will be there (CoreRPG reference doc frames) and leave it at that.

Moon Wizard
February 6th, 2019, 23:00
Interface.getFrames

However, you could just assume that the current CoreRPG set are the only ones, since they will always be available.

Regards,
JPG

celestian
February 6th, 2019, 23:21
Interface.getFrames

However, you could just assume that the current CoreRPG set are the only ones, since they will always be available.

Regards,
JPG

Gah, I can't believe I didn't see that, thanks!

My thought was that I would allow them to set the frame default for Author refmanual exports and give them a drop down menu list of them to use. Maybe even do it per story entry so they could use different types for various reasons.

Right now I've set it to just use CoreRPG's but somewhere, someone is going to ask... "hey Starfinder has this frame I want to use". I figured if I could easily get the list the options would be useful.

Thanks to your tip that should be easily done ;)

Bidmaron
February 6th, 2019, 23:41
I was not at my computer to check if theee was an API. Needless to say, I don’t have the API memorized. ( heck, I used to joke when I was in navy that the great thing was I could look at my name tag when I forgot my own name)

Moon Wizard
February 7th, 2019, 00:20
I have to look things up in the API all the time as people ask. I usually have a rough idea before I go looking, but I like to double-check before I answer. Some of the APIs I haven't needed to look at for long stretches.

Regards,
JPG

Moon Wizard
February 7th, 2019, 00:21
As for the ruleset-specific frames, I usually try to dissuade developers from doing stuff like that, since it adds inconsistencies between rulesets of a common feature.

JPG

dulux-oz
February 7th, 2019, 03:06
Actually, talking about the API - any chance of getting the Ruleset API Reference updated - the impression I get is that the webpage(s) (https://www.fantasygrounds.com/refdoc/) don't have the "full 100%" list, or am I mistaken?

damned
February 7th, 2019, 03:18
As for the ruleset-specific frames, I usually try to dissuade developers from doing stuff like that, since it adds inconsistencies between rulesets of a common feature.

JPG

Hahahaha - Ive made dozens of ruleset specific reference manual frames!

LordEntrails
February 7th, 2019, 03:58
Hahahaha - Ive made dozens of ruleset specific reference manual frames!
Bad! Bad Damned!

celestian
February 7th, 2019, 05:18
As for the ruleset-specific frames, I usually try to dissuade developers from doing stuff like that, since it adds inconsistencies between rulesets of a common feature.


If that's the case perhaps I will just get a static list of the CoreRPG ones and build the list from that. I've tested it and it seems to work fine but if the issue is wanting to port non-specific (theme/ruleset) that will be an issue. I think if they do use a non-available frame for a ruleset it would just show as normal (with no frame) viewing the ref-page.

To explain my goal...I am working towards a much more simple version of ref-manual than you can actually do in a ref-manual. Since I can't have multiple blocks in a Story record and I don't want to develop a markup language it will simply be a frame for that page. If the page has images the frame will stop at the image, then start again after.

Maybe somewhere down the road Story entries will change and make it easier to do it in-FG but for now I think this option will be easy to use and give the ref-mans a bit more pop w/o having to edit xml or learn another markup.

This looks much better than the no-frames versions.

https://i.imgur.com/NlMy3nq.png

Bidmaron
February 8th, 2019, 00:18
Celestian, that looks spectacular. All I can say....