PDA

View Full Version : I only want to show effect summaries in the CT for players for their own character



alloowishus
December 20th, 2024, 02:36
I found a setting to turn off effects descriptions, but basically I only want to show full descriptions of effects for the players own character, everything else I just want to show the symbols on the tokens.

I found this piece of code in ct_effect_summary.lua

function onEffectsChanged()
-- Set the effect summary string
local sEffects = EffectManager.getEffectsString(window.getDatabaseN ode());
if sEffects ~= "" then
setValue(Interface.getString("ct_label_effects") .. " " .. sEffects);
else
setValue(nil);
end

So I need to somehow figure out that the CT entry is the player logged in and have an AND condition after "if sEffects ~= "" " but I'm not sure how to do this. I think I get can get the nodeChar by getting window.getParent().getParent() and then finding the "owner", but how do I get the logged in players login name?

Thanks!

alloowishus
December 20th, 2024, 03:18
I actually figured it out myself, I found a function called "isCTEntryOwner()"

I just got the node inside onEffectsChanged()

nodeCT = window.getDatabaseNode();

then added

if sEffects ~= "" and isCTEntryOwner(nodeCT) then

function isCTEntryOwner(nodeCT)
if not nodeCT then
return false;
end
if Session.IsHost then
return true;
end
Debug.chat ("Owner" .. DB.getValue(nodeCT, "owner", ""));
Debug.chat ("username " ..User.getUsername());
return (DB.getValue(nodeCT, "owner", "") == User.getUsername());
end