Paul Pratt
August 4th, 2017, 07:10
Hello,
I am working in some new territory here so any help is appreciated. I have been reading through the "User" portion of the developer guide and have only managed to get myself lost. I am trying to create an option that will modify a portion of the character sheet with an option players can set. It works, but if the GM has the same option set to a different setting the GM's display will be different.
Sample. The option can set a label to read X, Y, or Z. The player sets the label to X. The GM has the same option set to Y. The player's charsheet displays X, the GM opens the player's charsheet and will see Y. How can I set this so the GM is forced to see the option the player has chosen, i.e. X?
Code I have so far:
function onInit()
OptionsManager.registerCallback("CGS", updateDisplayGear);
updateDisplayGear();
end
function onClose()
OptionsManager.unregisterCallback("CGS", updateDisplayGear);
end
function updateDisplayGear()
local sOp = OptionsManager.getOption("CGS");
local bDH1 = sOp == "dh1";
local bRT = sOp == "rt";
local bDW = sOp == "dw";
local bBC = sOp == "bc";
local bOW = sOp == "ow";
local bDH2 = sOp == "dh2";
influence_label.setVisible(bDH1 or bRT or bDW or bOW or bDH2);
influence.setVisible(bDH1 or bRT or bDW or bOW or bDH2);
infamy_label.setVisible(bBC);
infamy.setVisible(bBC);
--Changes to fields
if bDH1 or bDH2 then
influence_label.setValue("INFLUENCE:");
elseif bRT then
influence_label.setValue("PROFIT FACTOR:");
elseif bDW then
influence_label.setValue("RENOWN:");
elseif bOW then
influence_label.setValue("LOGISTICS:");
end
end
I am working in some new territory here so any help is appreciated. I have been reading through the "User" portion of the developer guide and have only managed to get myself lost. I am trying to create an option that will modify a portion of the character sheet with an option players can set. It works, but if the GM has the same option set to a different setting the GM's display will be different.
Sample. The option can set a label to read X, Y, or Z. The player sets the label to X. The GM has the same option set to Y. The player's charsheet displays X, the GM opens the player's charsheet and will see Y. How can I set this so the GM is forced to see the option the player has chosen, i.e. X?
Code I have so far:
function onInit()
OptionsManager.registerCallback("CGS", updateDisplayGear);
updateDisplayGear();
end
function onClose()
OptionsManager.unregisterCallback("CGS", updateDisplayGear);
end
function updateDisplayGear()
local sOp = OptionsManager.getOption("CGS");
local bDH1 = sOp == "dh1";
local bRT = sOp == "rt";
local bDW = sOp == "dw";
local bBC = sOp == "bc";
local bOW = sOp == "ow";
local bDH2 = sOp == "dh2";
influence_label.setVisible(bDH1 or bRT or bDW or bOW or bDH2);
influence.setVisible(bDH1 or bRT or bDW or bOW or bDH2);
infamy_label.setVisible(bBC);
infamy.setVisible(bBC);
--Changes to fields
if bDH1 or bDH2 then
influence_label.setValue("INFLUENCE:");
elseif bRT then
influence_label.setValue("PROFIT FACTOR:");
elseif bDW then
influence_label.setValue("RENOWN:");
elseif bOW then
influence_label.setValue("LOGISTICS:");
end
end