PDA

View Full Version : setValue Error on buttongroup_counter



LordEntrails
September 20th, 2025, 04:03
EDIT: Rubber Duck and all that. I had a button control counter that was not being used yet that for somereason now throws errors when it didn't used to. Discussed and decided we didn't need it there anyway, so just removed it and issue is solved.

My ruleset is throwing the following error for players (not host) whenever they open the Combat Tracker (or join the campaign if the CT was left open) in the FrontierSpace ruleset.


[9/17/2025 6:32:55 PM] [ERROR] Script execution error: [string "CoreRPG:..n/scripts/buttongroup_counter.lua"]:150: setValue: Unable to create node
This is being called from the template "buttongroup_counter" found in template_buttons.xml

buttongroup_counter.lua has 3 setValue commands, lines 148, 150 & 185

These are found in two sections;

function setVarNumber(sKey, n)
local sPath = self.getVarNumberPath(sKey);
if sPath ~= "" then
if (sKey == "current") and self.getMetadata("negative") then
DB.setValue(sPath, "number", -n);
else
DB.setValue(sPath, "number", n);
end
else
self.setVarNumberLocal(sKey, n);
end
end

and


if _tDataDefaults[sKey] then
if not DB.getValue(sPath) then
DB.setValue(sPath, "number", _tDataDefaults[sKey]);
end
end


I am at a complete loss as to what these are doing and what either changed in CoreRPG in the last ~4 weeks (I don't see any changes to my code related to these) and what I need to add to resolve this.

RosenMcStern
September 20th, 2025, 07:37
Based on the message and the fact that it happens only for players, it is clearly a problem of a cient trying to create an intermediate or leaf node on a node it does not own. It is a very common issue.

The best solution in this kind of case is to not create anything on client side and send an OOB message to the host to have it create the node on the player's behalf. But this is a little bit too complex, maybe. ;)

I think that in this case you should determine what is the value of the sPath variable. Then you can start understanding which part of its DB path is now non-writable for a player, and why. The solution might be as simple as adding a setPublic or setOwner instruction in another place, where the host creates (and claims ownership of) the path component that causes the trouble.

LordEntrails
September 20th, 2025, 16:36
Understood. I resolved it by simple removing the button counter that was not yet in use. (I had added it a long time ago for future capability and layout.)

If there is a remaining question, it is why with that section of the code not having changed in something like 12-18 months, why the errors now? Obviously due to a change in CoreRPG. If that change of behavior / error conditions was intentional, that's fine (I wasn't actually using it), but if such was not intentional, then Moon might want to look into it.

Moon Wizard
September 20th, 2025, 20:46
I'd need a reproduceable scenario. I'm assuming this button is being used in a window for both players and GMs; but only the GM has ownership.

Regards,
JPG

LordEntrails
September 20th, 2025, 22:51
I'd need a reproduceable scenario. I'm assuming this button is being used in a window for both players and GMs; but only the GM has ownership.

Regards,
JPG
If you want to pursue it (I'm not convinced it needs to be). I think you would need the whole ruleset right? FG Forge - View Item (https://forge.fantasygrounds.com/shop/items/2176/view)
I could pull out just the relevant code if you want to see what's going on, but, not convinced I would give you the right parts :) If you do want to pursue, tell me what you want if no the whole ruleset.

Steps to reproduce;

Start campaign as host
join campaign as player, create new PC
Host adds player to Combat Tracker
Player opens combat tracker (or re-join campaign)


As far as I intended, the code that's on the Forge (was planning on posting a rev, but can wait) the Destiny Points that are on the Combat Tracker are non-functional and are not yet tied to the Destiny points on the Character sheet. The thought was to eventually link them, but the feedback so far is that their is no need to, they can be used off the charactersheet, so I've just removed it from my development code.

Moon Wizard
September 21st, 2025, 00:10
Thanks for that. Just pushed a CoreRPG update that will prevent the error; but it does that by not allowing a user that is not the owner to attempt to set a value.
(By default, the control sets the value to be within the possible bounds, which is why the error was triggered when not the owner.)

Regards,
JPG