PDA

View Full Version : Stumped on using cycler



Samarex
June 20th, 2016, 14:10
Im Trying to use the cycler to put some infomation into a extension I am working on.

I have the following information

From my record_charship_main.xml


<cycler_shipsize name="hullsize">
<anchored to="shipinfo" position="insidetopleft" offset="20,40" width="80" height="20" />
<source><name>ship.hullsize</name></source>
</cycler_shipsize>
<label_fieldtop><anchored to="hullsize" /><static textres="charship_label_hullmod" /></label_fieldtop>

<basicnumberc name="hullsizemod" source="ship.hullsizemod">
<anchored to="hullsize" position="right" offset="20,0" width="30" height="20"/>
</basicnumberc>

From my template_char.xml


<template name="cycler_shipsize">
<button_stringcycler>
<parameters>
<labels>Micro|Fine|Diminutive|Tiny|Small|Medium|Large|Huge |Capital|Dreadnought|Station</labels>
<values>+10|+8|+4|+2|+1|0|-1|-2|-4|-8|-10</values>
</parameters>
</button_stringcycler>
</template>

The Button works (it cycles thru the label names fine. But what I want to do is have the number placed in the "hullsizemod" box) Having problems figuring it out. If its even possible. I'm sure its because the <values> are being treated as a "string", how can I get them to be a number so the mod box will take them. When I first put it in, it was switched, the Numbers were the Label and the text showed up fine in my name string , but I quickly realized that the numbers were just a label and I would not be able to read them into anything. So I changed things around to what I have above. Just can't get the numbers to show up.
Any guidance would be helpful.

Thanks
Samarex
Note (Really New with lua scripting )

Moon Wizard
June 20th, 2016, 21:36
I would probably just leave the field as a string value using the lower case version of the field values.

Then, you can either compute the modifier from the string value as needed, or if you need in a computation on the same page, you can use the onValueChanged event to capture changes to the cycler and set the bonus field appropriately.

Regards,
JPG