Text box randomly selects object name, how change the named objects animation?

I have a repeat timer as a CONDITION that every 2 minutes triggers a text box to randomly select an object name from a list of objects (the text box is set to use the function "choose::randomstring("object1, obj2, etc). Every 2 minutes when the text box lists a different object name I want to change that objects animation. How can I do this?

Hi @Ken2100,

Put all the objects from the list in a group. Use a For each “group” event and add this to it:

Compare strings: group.ObjectName() = textbox.Text() → change animation of “group”

1 Like

Thanks for the advice, question:

  1. I couldn’t find the “for each” function, can you give me a screen shot of exactly what it looks like

  2. When I did the compare string function it changed ALL of the animations of the objects in the group, I only want to change the animation of the object in the group that’s actually called, not the entire group.

This is why you need to put the condition / action in the For Each event.

The ObjectName() will not pick the object but it only returns true or false. The for each event loops through each instance of object and picks it, so if condition is true, then it will be true for the picked instance of object.

Is there a way to refer to a group of groups? For example, if I have 3 different groups of objects, each group has 2 objects in it, and I’m setting up an event that checks each group to see if the correct object animation has been changed (by player). Is there a “For Each” function where I can say For Each group in this list of groups check abc and if true do xyz?

No, this is not possible. You need to create a new group and include all these objects in it, and do for each new_group.