PDA

View Full Version : Ignoring <defaultlabel> in <button_stringcycler>



dulux-oz
November 1st, 2014, 10:57
Hi Guys,

One for the Devs, but feel free to chip in:

OK, so I'm using a <button_stringcycler> from the CoreRPG and everything is fine - except that the <defaultlabel> (and hence the <button_stringcycler>.defaultvalue) is giving me the sh!ts as I'm trying to code around it.

What I'd like to be able to do is use the <button_stringcycler> and have it ignore the <defaultlabel> and only use the <labels> and <values>, but at the moment if I leave <defaultlabel> out I get a blank (ie "") option as I cycle through the values of the <button_stringcycler>.

Is there a way of using the <button_stringcycler> in the manner I'd like (ie have I missed a tag option that will allow me to do this) or is there another template around that I haven't found yet which will do what I want?

My only other option is to re-code a version of the <button_stringcycler> and have the <button_stringcycler>.cycleindex return to 1, not 0 as it does now.

Any help would be appreciated.

(And yes, I know that we can use the <defaultlabelres> instead of the <defaultlabel> (etc) - that's not the issue.)

Cheers

Valarian
November 1st, 2014, 12:09
I've found that I have to modify the template string cycler Lua script to get the labels, rather than use the <labels> and <values> tags. I've not been able to get those to work either.

dulux-oz
November 1st, 2014, 12:33
I've found that I have to modify the template string cycler Lua script to get the labels, rather than use the <labels> and <values> tags. I've not been able to get those to work either.

Oh, I've got them to work OK (I use <button_stringcycler>.getStringValue()) - the trouble is, when using this function and the when the cycle is set to the defaultlabel (ie <button_stringcycler>.cycleindex == 0) I get a value of "" - and THAT'S my problem, because I need to search a string containing <button_stringcycler>.getStringValue(), and when <button_stringcycler>.getStringValue() == "" the search fails.

Valarian
November 1st, 2014, 13:38
I could only get it working by coding the strings and values in to the Lua script directly, copying the template string cycler script and modifying it, then calling that from the field template. IIRC, I think the template Lua script assumes a null, 0, 1 cycle.

Moon Wizard
November 4th, 2014, 17:40
The default value is always "". The default label is just what is displayed when the value is "".

Cheers,
JPG