PDA

View Full Version : How do I use User.isOwnedIdentity to determine if a charsheet is owned by user



SilentRuin
June 26th, 2020, 02:21
I'm trying to figure out how to determine if a callback function from a DB.handler is returning something owned by the player.

I thought User.isOwnedIdentity (https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4161868/User) was the way to go. But I can't figure out what to pass it for the sIdentity.

I've tried the charsheet.id-00002 and even gotten the combat tracker character name and passed that in. Starting with a character sheet node - how do I figure out if it's owned by the player running the code currently?

I'm hoping the answer is not get the user identity - read the DB for the owner someplace. I'm hoping there is easy magic I'm just unaware of.

Moon Wizard
June 26th, 2020, 02:41
On the player side, User.isOwnedIdentity only takes the short name of the PC database node (i.e. id-00002), and returns whether the current player owns the PC.
On the GM side, User.isOwnedIdentity takes 2 parameters, the short ID name and the user name, and returns whether that user owns that PC.

Regards,
JPG

SilentRuin
June 26th, 2020, 02:58
On the player side, User.isOwnedIdentity only takes the short name of the PC database node (i.e. id-00002), and returns whether the current player owns the PC.
On the GM side, User.isOwnedIdentity takes 2 parameters, the short ID name and the user name, and returns whether that user owns that PC.

Regards,
JPG

Hmm.. Guess I'll go the long way that can be run the same in both places. Thanks .



local sOwner = DB.getOwner(nodeChar);
local sUser = User.getUsername();
if not User.isHost() and sUser ~= sOwner then
... stuff...