My contribution: Automatically select random text
PROBLEM: You have a certain number of text phrases. You want to automate randomly inserting one of the text phrases.
/TriggersTheAction
{list=["Its a wonderful life", "To be or not to be that is the question", "Lex ordandi lex credendi"]}
{=list[ceil(random() * count(list))]}
SOLUTION: /TriggersTheAction outputs one of the above phrases like "Lex ordandi lex credendi"
Cool stuff @B_Strong !
On a side note, the TB forums allow you to post snippet previews like this:
{list=["Its a wonderful life", "To be or not to be that is the question", "Lex ordandi lex credendi"]}
{=list[ceil(random() * count(list))]}
You can do it by clicking on the "Gear" icon in the text editor window.
I want to make this even better @scott or @Cedric_Debono_Blaze can you help?
How would script look for a set of random phrases, followed by a second set of random phrases, then a third, and so on...? I know this does not work:
{list=["Its a wonderful life", "To be or not to be that is the question", "Lex ordandi lex credendi"]}
{=list[ceil(random() * count(list))]}
{list=["rain in Spain", "platonic thought is apriori thinking", "Lex vivendi"]}
{=list[ceil(random() * count(list))]}
{list=["Shall we dance?", "Rage against the night", "My wild hair rules the day"]}
{=list[ceil(random() * count(list))]}
Whereby desired output could be this:
Lex ordandi Lex cedendi
rain in Spain
My wild hair rules the day
scott
December 22, 2020, 4:22pm
4
You'll want to do something like
{list=["Its a wonderful life", "To be or not to be that is the question", "Lex ordandi lex credendi"]}
{=list[ceil(random() * count(list))]}
{list2=["rain in Spain", "platonic thought is apriori thinking", "Lex vivendi"]}
{=list2[ceil(random() * count(list2))]}
{list3=["Shall we dance?", "Rage against the night", "My wild hair rules the day"]}
{=list3[ceil(random() * count(list3))]}
SO EASY!!! --I bang my head with gratitude only surpassed by amazement.
@scott and/or @Cedric_Debono_Blaze
Given multiple text phrase =lists, what is the best way to change-up the order? For example:
Given:
{=list1[ceil(random() * count(list1))]; trim=yes}
{=list2[ceil(random() * count(list2))]; trim=yes}
{=list3[ceil(random() * count(list3))]; trim=yes}
{=list4[ceil(random() * count(list4))]; trim=yes}
Keep list1 and list4 in the same position, but Randomize list2 and list3 so that at random times the order output might be the result of this:
{=list1[ceil(random() * count(list1))]; trim=yes}
{=list3[ceil(random() * count(list3))]; trim=yes}
{=list2[ceil(random() * count(list2))]; trim=yes}
{=list4[ceil(random() * count(list4))]; trim=yes}
scott
December 23, 2020, 3:30pm
7
You can do something like:
{=list1[ceil(random() * count(list1))]; trim=yes}
{if: random() > .5}
{=list2[ceil(random() * count(list2))]; trim=yes}
{=list3[ceil(random() * count(list3))]; trim=yes}
{else}
{=list3[ceil(random() * count(list2))]; trim=yes}
{=list2[ceil(random() * count(list3))]; trim=yes}
{endif}
{=list4[ceil(random() * count(list4))]; trim=yes}