-
January 20th, 2023, 05:44 #1
- Join Date
- Feb 2018
- Posts
- 84
How do I load custom data for my extension to use?
Hello all,
I'm trying to create a new "kingdom sheet" to track the parties kingdom information.
No issues with creating the window ... but it starts with (no data) in it at all.
Code:<windowlist name="nationSkills"> <bounds>20,380,550,620</bounds> <class>skilldetail</class> <datasource>.nationSkills</datasource> <allowcreate /> <allowdelete /> </script> </windowlist>
and later, re-opening my campaign its pulling the data from the db.xml.
But, when I load a fresh campaign ... its just an EMPTY LIST again.
How do I "create" this on a fresh campaign ? (besides hacking the db.xml directly)
I tried the super obvious ones, like copying into an xml file and importing on startup ...
or using the "DB.import" command ... but no luck on either attempts.
Do I create an onInit() function for the windowlist ?
and somehow loop thru a local array of skill names ?
Or would this happen elsewhere, during loading ??
Would it use the DB.setValue or the DB.createChild functions ?
(if so, how exactly??)
I'm fairly new to LUA as well (only 1 week so far) ...
so, would appreciate any examples of how to code any relevant loop or such.
This is what it looks like in the db.xml file, if it helps.
Code:<nationSheet> <nationSkills> <id-00001> <circMod type="number">0</circMod> <itemMod type="number">0</itemMod> <skillName type="string">Agriculture</skillName> <skillProf type="number">0</skillProf> <skillStat type="string">STA</skillStat> <skillTotal type="number">1</skillTotal> <statBonus type="number">0</statBonus> <statusMod type="number">1</statusMod> <training type="number">0</training> <tRanks type="number">5</tRanks> </id-00001>
-
January 21st, 2023, 03:07 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,563
The ruleset/extension code manages the data structure and UI for the game system; but does not provide any built-in data. Each campaign has it's own database that the GM can customize for their group. In order to create a standard data module for use with a ruleset, you can export specific record types from a campaign into a data module (.mod) file that can then be loaded in other campaigns.
More info in the developer's guide:
https://fantasygroundsunity.atlassia...les+-+Overview
Also, there are a few user videos from the community that cover the topic of creating campaigns to build modules. I don't have the links myself, but I'm sure someone else in the community will be able to help out with links.
Regards,
JPG
-
January 21st, 2023, 05:18 #3
- Join Date
- Feb 2018
- Posts
- 84
Where does the XML file need to be for DB.import to work ?
<script>
--import skill data
DB.import("nm_skills.xml","nationSheet");
</script>
I tried in my campaign folder "root" and in the extension "root" even my FG-DATA folder ... but so far, it returns a script error
[ERROR] Script execution error: [string "W:nationsheet"]:2 import : Unable to open file
-
January 21st, 2023, 05:26 #4
- Join Date
- Feb 2018
- Posts
- 84
Ah! thank you - that does help explain a lot.
I'll stop trying to force it to work, lol - and move on with learning/building my project.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks