Hello!
I'm trying to take the contents of a list variable (ie; t, e, s, t, n and g) and convert them to a single string (ie; "testing").
I'd like it to be flexible to the size of the list however so I do not have to set it like "%{_list::1}%%{_list::2}%%{_list::3}%" and so on, which is the only way I can think of right now to do it. And that takes away to automation I want with it.
Any idea on how to do this or anything I can try? Been at it a while. Here's the code I have for reference:
It takes the text and splits it, then colors every other letter a certain color. This part works perfectly. Now I'm having trouble putting it back together into a single text string.
Thank you!
[doublepost=1602687749,1602568346][/doublepost]I think i just figured this out 5 min before i have to leave for work xD
If anyone knows a neater way to do it by all means~~~
I'm trying to take the contents of a list variable (ie; t, e, s, t, n and g) and convert them to a single string (ie; "testing").
I'd like it to be flexible to the size of the list however so I do not have to set it like "%{_list::1}%%{_list::2}%%{_list::3}%" and so on, which is the only way I can think of right now to do it. And that takes away to automation I want with it.
Any idea on how to do this or anything I can try? Been at it a while. Here's the code I have for reference:
Code:
command /splittest:
trigger:
set {_sp::*} to split "testing" by every 1 character #This is with Dovias's snippet
loop {_sp::*}:
set {_i} to loop-index parsed as integer
if {_i} is not divisible by 2:
set {_sp::%{_i}%} to "&6%loop-value%"
else:
set {_sp::%{_i}%} to "&e%loop-value%"
broadcast "%{_sp::*}%"
Thank you!
[doublepost=1602687749,1602568346][/doublepost]I think i just figured this out 5 min before i have to leave for work xD
If anyone knows a neater way to do it by all means~~~
Code:
command /ttt:
trigger:
add "t", "e", "s" and "t" to {_s::*}
set {_a} to 0
loop {_s::*}:
if {_a} > 0:
set {_v} to "%{_v}%%loop-value%"
add 1 to {_a}
else:
set {_v} to loop-value
add 1 to {_a}
send "%{_v}%"