To split one sentence to words. then create text object for each word

To split one sentence to words. then create text object for each word.
There is one option to control a random position or not.

You could use the javascript method string.split(" “). When you have the sentence, make it into a scene variable, the create a javascript event that uses
let strList = runtimeScene.getVariables().get(“name of the variable”).getAsString().split(” ")
for (let i in strList){
runtimeScene.getVariables().get(“name of the variable”).getChild(i+1).setString(strList[i])
}
to convert the string in a struct where 1 is the first word, 2 the second etc. There you can apply this method: How to batch create a lot of random objects in an event of a scene? - #3 by Gyuszko to create an instance for each.

1 Like

Hi, I’m trying to do something similar but I don’t know how, I’m trying to use 80k words as a dictionary, I tried to add them all in a variable but it detects them as a single text which would take up an array but to manually add each word would take forever, I appreciate your

It’s best to start a new post instead of replying to a 5 year old thread. You can always insert a link to this thread.

Putting that many words into an array sounds like a lot. Maybe you can format the list as a Json file. You would be able to load the Json file into a variable. That’s not my strength. So, I can’t help you with that. Honestly, I would break the list down into smaller prices if possible. Maybe by word size or like “a to e” or by levels. I don’t know your goal but a large array or string could cause lag and/or resource issues. A database or something external might be another option.

Another option would be to use a combination of the many text manipulation expressions. You can search for words or search for commas. Again, I don’t have any context to go with.

I recommend that you start a new post and provide more details. Otherwise, we’re just guessing.