Table of Responses
GamingtilDawn
Member Posts: 104
I am trying to figure out how to use tables to randomize a series of responses.
So for example: Joe says hi to Tim. I want Tim to respond randomly with 1 of the 5 available choices.
I have a table with 1 column and 5 rows. Each row has the response typed in it. I then set up a rule that says when a certain thing happens, Display text: random (tablecellvalue (responses, 1, 1), tablecellvalue (responses, 1, 5))
Am I going down the right path? Because all I keep getting is the #'s 1-5, not the responses.
Comments
Hi GamingtilDawn,
Maybe this can help:
God Bless....
Sincerely,
Sunday
The video might have the answer but I didn't want to watch all hour hour of it to make sure.
You're almost there.
You need to create a new self interger attribute, let's call it randomtext. Then, set that integer to a random number, matching the number of responses:
change attribute self.randomtext to random(1,5)
Then in your display text behaviour use the table cell value function, using the randomtext attribute to correspond to the row:
display text tableCellValue(YOURTABLENAME,self.randomtext,1)
You can wrap the random number generator in a rule if you want to change the text on an action, such as clicking
Thanks @luke2125 that video actually helped with another project.
Thanks @imjustmike that method worked out great!