PDA

View Full Version : encumbrance number problem



Gordon228
May 27th, 2017, 19:34
for my BESM rule set i had finally managed to get multiple inventory lists into the sheet but now one part of the sheet is broken and that is the encumbrance value. in the images you can see that on one sheet i put 50 as the WT and on the other i put 25 but no matter what i have tried i can gett the 25 to show up in the encumbrance spot even as adding to the 50 witch is what i want it to do and i have looked everywhere i could find but can't find how to fix this.

Trenloe
May 27th, 2017, 20:18
Look at the database fields that these controls are sourced to. Usually the control name - but could be different which will be specified in a <source> tag.. Make sure you have different database sources. Then, you're going to need to look at the CoreRPG LUA code that does the additions calculations and modify these to get the data from the fields you want. TIP: look for the <script> tags in the FG XML - it will either contain a LUA filename or a short piece of LUA code, probably in the windowlist control.

You're going to have to learn some LUA coding now.

https://www.fantasygrounds.com/modguide/scripting.xcp

For this, look at the <script> tag in the <template name="list_charinv"> control. This points to "campaign/scripts/char_invlist.lua"

This LUA file does operations against the underlying FG database - primarily based off database event handler function. Info on the FG database here:http: //www.fantasygrounds.com/modguide/database.xcp and handler functions at the bottom of the scripting page (link a few lines up in this post).

The onInit/I] function (which runs when the script is initialised) sets up a few onUpdate event handler functions. The one of interest here is onEncumbranceChanged which is called when the weight or number of an inventory item is changed, or an inventory item is deleted. [I]onEncumbranceChanged called a global package function: CharManager.updateEncumbrance(window.getDatabaseNo de()) which includes the database node for the <windowlist> control. The CharManager package is campaign/scripts/manager_char.lua - you'll see that the updateEncumbrance function always updates the database field encumbrance.load which is a child node of the nodeChar database node (passed via window.getDatabaseNode()).

This can get very challenging for a novice FG developer. But, if you're wanting to do customisations such as this, you'll have to spend the time reading the documents, tracing through the various XML and LUA files, understanding the code (reference guides for LUA are linked in the Scripting page), understanding the FG database and how to code against it, and finally actually doing the changes and tests.

Further info on the FG database element APIs here: https://www.fantasygrounds.com/refdoc/DB.xcp and here: https://www.fantasygrounds.com/refdoc/databasenode.xcp

This is not a quick or simple process, you're going to have to teach yourself LUA programming (have at least a base understanding of it) and then apply that to the FG architecture. Read the documentation and look at example code - there's plenty of that in the FG rulesets.

Gordon228
May 27th, 2017, 22:10
I figured my copy paste way of doing things was coming to an end so when I get time I will look at everything and get it working