PDA

View Full Version : Trouble with button_stringcycler...



Blackfoot
November 13th, 2013, 21:37
I am trying to add a cycle button to a variant of the 3.5 skill tab.
Pulling out the 'class skill' button and replacing it with one that has 4 settings for the 'type' of skill.
In Champions there are 4 types of skills:
Untrained - 6 or less
Familiar Skills - 8 or less
Background Skills - 11 + ranks or less
Trained Skills - 9 + stat/5 + ranks or less


<button_checkbox name="state">
<bounds>22,8,12,12</bounds>
<script>
function onValueChanged()
CharManager.updateSkillPoints(window.getDatabaseNo de().getChild("..."));
end
</script>
</button_checkbox>-->
Replaced with this:

<cycler_charskilltype name="state">
<bounds>22,2,12,20</bounds>
<script>
function onValueChanged()
window.onStatUpdate();
-- I realize this is all wrong.. but I'm still working on this script... suggestions here would help.
end
</script>
</cycler_charskilltype>
Using this template:

<template name="cycler_charskilltype">
<button_stringcycler>
<parameters>
<labelsres>utr|fam|bg|tr</labelsres>
<values>untrained|familiarity|background|trained</values>
</parameters>
</button_stringcycler>
</template>

This ends up looking really pretty and all.. puts it in the right spot.. nice little box and all.. but when I click it it gives me this error:

Script Error: [string "common/scripts/button_stringcycler.lua"]:251: bad argument #1 to 'setValue' (number expected, got string)
and doesn't toggle through the values. I'm not sure why it looking for a number.. I copied this cycler setup from the abilities cycler.. and it is all strings.

Moon Wizard
November 14th, 2013, 00:57
The stringcycler control is attempting to write the string value of the next value in the cycle to the node with the same name as the stringcycler control. However, the error message is stating that the underlying control has the "number" data type, which means that it is being set as a number somewhere else.

* Check for other fields/controls with the same name.
* Check for number_linked/number_modifier fields which attempt to update when this field changes. For those field templates, they automatically create a number field to link to, unless you specify string. (See common/scripts/number_linked.lua in the CoreRPG ruleset; specifically the onInit and addSource functions) Also, the 3.5E ruleset has an example for the "number_charweapondamagetotal" template and the "number_charweaponattacktotal" template.
* If you don't find anything with those two hints, it's probably in some Lua script code with a createChild or DB.setValue call.

Cheers,
JPG

Blackfoot
November 14th, 2013, 19:41
My cycler is working spiffily now, thanks again for the assist!