PDA

View Full Version : IconCycler Not Initializing



LordEntrails
September 9th, 2025, 01:16
So with a recent update to CorePRG (last few weeks, so maybe with 4.8.x) I've noticed that some IconCyclers I have on the character sheet are no longer visible until after some actions/scripts are activated.

Int his case I have an iconcycler for each attribute to make advantage/disadvantage rolls for the attribute. 6 iconcycler and 6 attribute. on a new character sheet they adv/dis icons are invisible until one of the attributes is rolled, then they become visible.

This is 'new' behavior, as it did not happen under 4.7.x but now does.

Suggestions on what I need to update or is this something with CoreRPG that needs to be fixed?


<button_iconcycler name="adv_strength">
<bounds>61,5,19,19</bounds>
<parameters>
<defaulticon>stats_none</defaulticon>
<icons>stats_none|stats_advantage|stats_disadvantage</icons>
<values>0|1|-1</values>
<tooltipsres>charsheet_main_adv_strength_Tooltip_0|charsheet_ma in_adv_strength_Tooltip_1|charsheet_main_adv_stren gth_Tooltip__1</tooltipsres>
<nodefault />
</parameters>
<script>function onClickRelease(button, x, y)

local nodeChar = window.getDatabaseNode();

if getValue() == 0 then
DB.setValue(nodeChar, "adv_agility", "string", 0);
DB.setValue(nodeChar, "adv_coordination", "string", 0);
DB.setValue(nodeChar, "adv_perception", "string", 0);
DB.setValue(nodeChar, "adv_intelligence", "string", 0);
DB.setValue(nodeChar, "adv_willpower", "string", 0);
end

end

</script>
</button_iconcycler>

(Note, I've got similar checkboxes that do not show this same behavior)

Moon Wizard
September 9th, 2025, 22:09
I tried a couple scenarios.


Because you have the nodefault, you would need to define a defaultindex. I'll add a check for nodefault to assume defaultindex = 1 in the future.



<iconcycler_listitem_right name="adv_strength">
<parameters>
<icons>die_general_icon|d6gicon|d6ricon</icons>
<values>0|1|-1</values>
<tooltipsres>charsheet_main_adv_strength_Tooltip_0|charsheet_ma in_adv_strength_Tooltip_1|charsheet_main_adv_stren gth_Tooltip__1</tooltipsres>
<nodefault />
<defaultindex>1</defaultindex>
</parameters>
<script>
function onValueChanged()
-- Values are "0", "1", "-1"
if getValue() == "0" then
Debug.chat("DO STUFF");
end
end
</script>
</iconcycler_listitem_right>




However, it would be better to do it something like one of these two instead:

OPTION 1 - button_iconcyler with default


<iconcycler_listitem_right name="adv_strength_2">
<parameters>
<defaulticon>die_general_icon</defaulticon>
<defaulttooltipres>charsheet_main_adv_strength_Tooltip_0</defaulttooltipres>
<icons>d6gicon|d6ricon</icons>
<values>1|-1</values>
<tooltipsres>charsheet_main_adv_strength_Tooltip_1|charsheet_ma in_adv_strength_Tooltip__1</tooltipsres>
</parameters>
<script>
function onValueChanged()
-- Values are "", "1", "-1"
if getValue() == "" then
Debug.chat("DO STUFF - 2");
end
end
</script>
</iconcycler_listitem_right>


OPTION 2 - buttonfield


<button_listitem_right name="adv_strength_3">
<state icon="die_general_icon" tooltipres="charsheet_main_adv_strength_Tooltip_0" merge="add" />
<state icon="d6gicon" tooltipres="charsheet_main_adv_strength_Tooltip_1" merge="add" />
<state icon="d6ricon" tooltipres="charsheet_main_adv_strength_Tooltip__1" merge="add" />
<script>
function onValueChanged()
-- Values are 0-2; This is how item carried state and similar buttons work
if getValue() == 0 then
Debug.chat("DO STUFF - 3");
end
end
</script>
</button_listitem_right>



Regards,
JPG

LordEntrails
September 10th, 2025, 05:17
Thanks Moon. I just removed the <nodefault /> and it works as desired now. Not sure why I had that and didn't even think of it when looking at the vode.
As always, appreciate your help!