PDA

View Full Version : Writing for FG Store



Varsuuk
May 20th, 2018, 05:15
This topic is covered in the linked Developer Guide by JPG but there are probably other things not listed.

For example, and I cannot remember specifics enough to search for it, I recall reading something about something (great detail man aren't I?) needing to use things like <id-0001> vs <warrior> in a list of classes for example? Hopefully someone knows what I am partially remembering.

Also, as I asked elsewhere - if there are preferred db path naming for new rulesets to abide with, since several are listed as "only for this ruleset you shouldn't use in new ones" etc.

Thanks :)

EDIT: Like in https://www.fantasygrounds.com/wiki/index.php/DLC_Guidelines there is description of what you put where. recall common.xml - is this deprecated because of new only db/client.xml guideline?

Trenloe
May 20th, 2018, 13:15
Also, as I asked elsewhere - if there are preferred db path naming for new rulesets to abide with, since several are listed as "only for this ruleset you shouldn't use in new ones" etc.
https://www.fantasygrounds.com/wiki/index.php/Data_Structure_Overview_and_Best_Practices

Look at modules. The base FG data in modules mirrors the ruleset database structure.

Talyn
May 20th, 2018, 19:54
The page @Trenloe linked is your best source for datapaths, etc. Yes, they want client.xml and db.xml rather than common.xml now. Reverse your naming scheme, though; FG will inherently do <id-000nn> but you'll notice all official reference DLC (players handbook, monster manual, and so forth) use the actual name, no spaces (duh it's XML), lowercase. (Make a custom Note page for links and drop a few things like spells, items, monsters, etc. to see the naming scheme in action as well as getting datapaths for whatever ruleset if the Best Practices page isn't clear for some reason).

LordEntrails
May 20th, 2018, 22:09
Why names rather than ID numbers?

Talyn
May 20th, 2018, 23:05
I don't know the official reason, but I suspect it's the same as my personal reason: it's a helluva lot easier to find what I need to edit/fix/whatever when I can see the name right in front of my face rather than having to either open each id-000nn entry or do a search function in whatever text editor I'm using. Also, if I'm nose to the grind in my text editor, I can very quickly type in the name to a link rather than having to take the time to look it up and paste it because I know it's always going to use the same syntax.

Trenloe
May 20th, 2018, 23:17
Why names rather than ID numbers?
The main reason is for FG functionality that does a lookup based off the name. For example, spells in 5E: https://www.fantasygrounds.com/forums/showthread.php?40736-NPC-Engineer&p=388791&viewfull=1#post388791

So, it's not needed for everything, but it is good practice to do.

Talyn
May 20th, 2018, 23:25
I was just going to edit and mention doing wildcard links, which your post on that thread does @Trenloe. That saves everyone a lot of headaches when we can just do something like reference.spells.dancinglights@* (Pathfinder) or reference.spelldata.dancinglights@* (5E) and that link will work for official modules, SRD modules, and community modules so that as many players get to use the content as possible rather than forcing everyone to use specific DLC.

Varsuuk
May 21st, 2018, 01:29
https://www.fantasygrounds.com/wiki/index.php/Data_Structure_Overview_and_Best_Practices

Look at modules. The base FG data in modules mirrors the ruleset database structure.

https://www.fantasygrounds.com/wiki/i...Best_Practices Is the very link that opened more questions for me (I've read the Wiki links in at least the "Developer Notes" section Moon stickied.

In that link there are many paths, for many rulesets with many caveats. Looking at modules, I was confused because they listed some "recommended" then they specifically list for what rulesets then after the list some used in 5E but not recommended for future rulsets. I tried to parse the wording as an algorithm and got a bit list I guess.

Here are additional recommended reference data paths used in specific rulesets.
...
"reference.classes" = Classes (3.5E, CnC)
...
...

Here are any exceptions noted in existing rulesets, but are not recommended usage for new rulesets.

...
"reference.classdata" = Classes (5E)
...



I get it now, the earlier list IS the recommendations for all new rulesets (where they match the concepts in the rulesets) and not just a list of (using "Classes" as the example) of the different ways you can list classes.... pick one... but don't pick 5E and the first one we mentioned was SPECIFIC to 3.E/CnC ... so, ummm? ---> Yes, it's on me - I was confused. Others were most likely not. So that one is on me - sorry. At least writing my post and your answer forced me to reread it in a different "tone" and I get it now. The section prior to the "Here are any..." IS the recommendations!

Thanks :)

Varsuuk
May 21st, 2018, 01:32
I don't know the official reason, but I suspect it's the same as my personal reason: it's a helluva lot easier to find what I need to edit/fix/whatever when I can see the name right in front of my face rather than having to either open each id-000nn entry or do a search function in whatever text editor I'm using. Also, if I'm nose to the grind in my text editor, I can very quickly type in the name to a link rather than having to take the time to look it up and paste it because I know it's always going to use the same syntax.

When I was making sub elements, I always put in names vs numbers (then of course a <name type="string">nameagain</name> entry) because it just read easier. I assumed the id-000nn was just a function of the GUI inserting an entry well before it knew what you may prefer to call it ;) I assumed that numbers were only for generated things.

Then I recall reading a post back when I was not anywhere near up to creating modules via XML that there was some reason to use the numbers if you wanted to match some SW FG Store requirement. *** NOW I AM LIKELY REMEMBERING WRONG *** ;) but was checking in case there was any accuracy to my memory. I wanted to find that mention or have it explained so I do not need to undo work later.




But from the link Trenloe listed, maybe I was remembering seeing the OPPOSITE? A thread discussing how you should RENAME some things to "names" vs "id-000nn" style?
IF so, I am gold 'cos that is how I PREFER to write my XML. I really do not want to use id-000nn if can avoid it for my class/race/etc mod files. But if I should use numbers because of some design best practice, I certain am willing to switch back to it.

So, is there a case where I should NOT use "named" elements vs "generic numbering"?

Trenloe
May 21st, 2018, 01:36
Short answer to a long question : no. :-)

Varsuuk
May 21st, 2018, 01:47
Short answer to a long question : no. :-)

YAY! Glad can stick to names.
Thanks Trenloe.

Apologies on my inability to be succint (even when thanking you and I could have left it at that... if only I remembered to take meds...)