Thanks for the answer. I'll wait for an update.
/Peter
Printable View
Thanks for the answer. I'll wait for an update.
/Peter
- I'm running a new BRP campaign with no extensions.
- I'm running on FGU.
- I did an update just before running the test.
- [4/5/2021 2:29:55 PM] FGU: v4.0.10 ULTIMATE (2021-02-04)
- [4/5/2021 2:29:55 PM] OS: Windows 10 (10.0.0) 64bit
- [4/5/2021 2:30:45 PM] RULESET: Basic Roleplaying: the Chaosium Roleplaying System (v2021-03-09)
- [4/5/2021 2:30:45 PM] RULESET: Core RPG ruleset (v2021-04-06) for Fantasy Grounds
In order to replicate this test the "Use Skill Category Bonuses" House Rule needs to be set to "on" in the Prefs window.
When I change the value of a characteristic, I get the following warnings and errors:
The category bonuses are calculated correctly! Even though FGU throws this error.Code:[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [WARNING] setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
[4/11/2021 1:17:27 PM] [ERROR] Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
I have also tested to do the same on FGC with the latest version of the ruleset(s) and there where no errors and the category bonuses where calculated correctly. I also did a test with a pre-coreRPG version of the Basic Roleplaying ruleset (in FGC) and there where no errors and the calculations where correct.
As far as I can see the code (in the function recalc) is the same in the post-coreRPG and the pre-coreRPG versions of the ruleset. I've tried to come up with a fix but so far I have failed, so any help is appreciated.
Hi,
I've had some success going forward with the "catname" problem. The problem is the recalc() function, which is called from three places in the windowclass "charsheet_skillcategory". If I move the recalc functions code to the two controls that calls it and modify it a bit, then that code works, the category bonuses are correctly calculated.
For the "catname" label:
and for the "bonus" basicnumber control:Code:function onValueChanged
if super and super.onValueChanged then
super.onValueChanged()
end
local name = getValue()
Debug.console("category", name)
local value = window.windowlist.getBonus(name)
Debug.console("bonus", value)
window.bonus.setValue(value)
end
**************Code:function onValueChanged
if super and super.onValueChanged then
super.onValueChanged()
end
local name = window.catname.getValue()
Debug.console("category2", name)
local value = window.windowlist.getBonus(name)
Debug.console("bonus2", value)
bonus.setValue(value)
end
So, so far so good, but the function recalc() is also called by the update() function which in turn is called by the onInit() function the first time you click on the skill tab. The update function can access the bonus control and make it visible, so it has access to the "bonus" control. If I edit the update() function, like below, and reload the ruleset and click on the Skill tab, then the debug statement "Debug.console("category4", name)" displays "s'category4' | s''". That is, it cannot access (or find) "catname", but it can access "bonus". The later is easy to verify because category names and bonus values are visible. The controls "bonus" and "catname" sould be in the same scope, right? So why can't I access "catname"?
**************Code:function update()
print("update()")
local sOptionHRSCB = OptionsManager.getOption("HRSCB")
if sOptionHRSCB == "on" then
local node = windowlist.window.getDatabaseNode().createChild("abilities")
node.onChildUpdate = recalc
bonus.setVisible(true)
bonuslabel.setVisible(true)
local name = catname.getValue()
Debug.console("category4", name)
local value = windowlist.getBonus(name)
Debug.console("bonus4", value)
bonus.setValue(value)
else
bonus.setVisible(false)
bonuslabel.setVisible(false)
end
end
The recalc() function is also accessed when a characteristic on the Main tab is changed (the line node.onChildUpdate = recalc in the update() function). When you access recalc() this way it throws an "attempt to index global" error. And it doesn't seem to mather what statement you put first in the function.
When I change the recalc() functions code and inserts a few debug statements and a print statement, like this:
Then I get the error: "attempt to index global 'print' (a nil value)". If I change the print statement to a debug statement, the error messages changes to "attempt to index global 'Debug' (a nil value)". There are two recalc funcions in record_char_skills.xml, so I renamed the recalc() function in charsheet_skillcategory to recalcat(), but that didn't have any effect. What would make a statement in a function throw "attempt to index global", regardless of what statement it is?Code:function recalc()
print("recalc()")
local name = catname.getValue();
Debug.console("category3", name)
local value = windowlist.getBonus(name);
Debug.console("bonus3", value)
bonus.setValue(value);
end
**************
Finally, It's worth noting that the code seems to work fine in FGC, from what I can tell.
/Peter
If you want to recreate this behavior you can use the extension below. It loads the record_char_skills.xml that I've been modifying. Don't forget to turn on "Use Skill Categories" in the preferences.
I found this post when searching for info on "attempt to call global". It seems to suggest that the value of a genericcontrol cannot be accessed by getValue(). But I'm able to do so in
"catname" genericcontrol:
The post above is a couple of years old. Has this changed?Code:function onValueChanged
if super and super.onValueChanged then
super.onValueChanged()
end
local name = getValue()
Debug.console("category", name)
local value = window.windowlist.getBonus(name)
Debug.console("bonus", value)
window.bonus.setValue(value)
end
The "genericcontrol" object type does not support the getValue function; as the genericcontrol object does not support a database value nor is able to link to a database node.
The "catname" control may be a template which resolves to a stringcontrol/stringfield, which is why it works there.
Regards,
JPG