For loops and bbcode don't play nice with =

This code normally would "work" when you replace the = with something else, but otherwise it returns 0s for the length of the string.

``\$fl(1, tc(len, gv(test)), "i + 1","[c=cm((mu(cos,(df(ss)+i)*6)+1)/2*255,(mu(cos,(df(ss)-20+i)*6)+1)/2*255,(mu(cos,(df(ss)-40+i)*6)+1)/2*255)]+tc(cut,tc(cut, gv(test),-i), 1)+[/c]", "")\$``

Here's a more simplified version to actually demonstrate the 0s.

``\$fl(1, tc(len, gv(test)), "i + 1","[c=#00ffaa]+tc(cut,tc(cut, gv(test),-i), 1)+[/c]", "")\$``

The problem is that BB code is not supported inside a formula and for loops are using formulas this then basically parses the "=", not really possible to fix

I see, so you wouldn't have a workaround for me?

There's no way to make the = behave as a string to the formula, but be evaluated in the bbcode after the new string is constructed?

Eh I'll just settle for using the fx gradient, shame this isn't possible though. And thanks for your time.

Sorry to resurrect a dead thread but I thought I'd point out that you can use BB code within formulae. For example, the below is perfectly valid for producing bold text:

``\$fl(0, 2, "i+1", "[b] foo [/b]", "bar")\$``

Furthermore, you can avoid treating the '=' and colour value as literals (with reference to the original issue) by placing them within \$ symbols. For example:

``\$fl(0, 2, "i+1", "[c\$=#2F78FF\$] foo [/c]", "bar")\$``

That still doesn't resolve allowing that number to change does it? I've since made everything work nicely with the fx though.

Yeah, it should do:

so, mango's solution didn't work for me, but I found my own and i wanted to leave it here in case anyone starts looking...

you could make a global variable with the [c=...](op's original formula with the 'i' should work) and another with the [/c]. then, you can write the formula like:

`\$fl(1,tc(len,gv(test)),"i+1","gv(color)+tc(cut,(tc(cut,gv(test),-i,1)+gv(end)","")\$`

where:

gv(color) is a text global set to

`[c=cm(mu(cos,...255)]`

and gv(end) is also a text global set to

[/c]

Resurrecting once again. I was just helping another Kustom user work this dilemma out... To piggyback off of Mango's post from a while back, the follow works with BB code in an if statement as well.

``\$if(bi(charging)=0,"[c=#FFFF0000]Discharging![/c]","[c=#FF047E26]Charging![/c]")\$``