PDA

View Full Version : DB.isOwner returning false unexpectedly



anathemort
January 20th, 2022, 00:58
I have a client connected with two characters in their possession and added to the CT (added after the client took ownership). I am trying to use DB.isOwner to determine if the OOB recipient is the owner of the active CT token:

function toggleSelectedToken(bSelect)
local nodeActive = CombatManager.getActiveCT();
Debug.chat('rcv token select', bSelect, nodeActive, DB.isOwner(nodeActive));

if not DB.isOwner(nodeActive) then
return;
end
-- etc.


However, in this screenshot, you can see when it becomes Turgarth's turn, DB.isOwner returns false instead of the expected true. (The first debug print is from my "deselect Aris on his turn end" logic.) This is from the client's view.
51077

And from the host view, you can see "anathemort" is the owner of both characters.
51078

Did I get something wrong here? Thanks!

Trenloe
January 20th, 2022, 01:20
Only the GM owns database nodes in the combat tracker. Check the database node your code is looking at in db.xml - you'll see there's no <holder> tag, which will indicate who is the owner (assuming the owner="true" property is used as part of the <owner> tag), as only the GM owns the data in the database.

If you want to see who owns the character, you'll need to look at the <charsheet> entry for the PC, not the combat tracker entry.

anathemort
January 20th, 2022, 03:36
Thanks very much Trenloe, that is clarifying :)