GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Table of Responses

GamingtilDawnGamingtilDawn Posts: 104Member
edited June 2016 in Working with GS (Mac)

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

  • luke2125luke2125 Posts: 225Member, PRO

    Hi GamingtilDawn,

    Maybe this can help:

    God Bless....

    Sincerely,

    Sunday

  • imjustmikeimjustmike Posts: 450Member

    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

  • GamingtilDawnGamingtilDawn Posts: 104Member

    Thanks @luke2125 that video actually helped with another project.

    Thanks @imjustmike that method worked out great!

Sign In or Register to comment.