Making random phrases appear on screen

ucornucorn Member Posts: 12
Hi all,

I'm new to GameSalad but am really grateful this software exists for rookies like me. I'm working on a scene where random phrases need to appear on screen, but I'm a bit lost.

After the game ends, and final score appears, I've put in a new scene where an actor will appear and say a random phrase/line (out of a total of 20 such remarks/phrases) about the performance of the gamer. I know I have to put in an actor that displays text, but I don't know how to spawn random phrases so it's not the same line that comes over and over again.

Any guidance will be very valuable.

Thanks!

Comments

  • ucornucorn Member Posts: 12
    edited March 2014
    Silly mistake about leaving in the email. Could the admins change that, please? I've changed my username in my profile settings but it's not showing up here :-/
  • TheGabfatherTheGabfather Member Posts: 633
    edited March 2014
    An easy way is to store all your phrases inside a simple Table with one column e.g. tblPhrases

    Then you can just do in your Display Text behaviour:
    tableCellValue(game.tblPhrases, random(1,X), 1)
    where X is your maximum number of rows.

    The 1st parameter is your Table's name, the 2nd is the Row number, and the 3rd is the column number.

    The random(x,y) function gives you a random value from x to y.

    Also remember to select your table's name from the navigator inside the Expression Editor. It will produce an error if you type it in manually.
  • ucornucorn Member Posts: 12
    thanks! works like a charm. could the moderators change my username in this question, please? i cant seem to fix it.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    thanks! works like a charm. could the moderators change my username in this question, please? i cant seem to fix it.
    Believe me, we'd like to help you out! Unfortunately, we're not able to and you'll need to contact GameSalad Staff for help with that: http://gamesalad.com/support.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.