Selecting random table

Hi everyone,

I was wondering if it is possible to select a random table to pull values from? I haven't found a solution to this and was wondering if it is even possible

thanks

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited April 2013

    Hi @zoidbergsghost It could be simpler to just have the one Table but with added columns for different sets of values; in other words, select random column.

    So something like:

    Rule: When touch is pressed
    Change Attribute ChooseValue to tableCellValue(game.YourTable, game.YourColNum,random(1,5))

    --- the value 5 are as an example of course, change to your actual amount columns in your table--

    (Display Text game.ChooseValue)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • zoidbergsghostzoidbergsghost Member Posts: 6
    Thanks a lot @gyroscope. The thing is that I can't figure out how to achieve what I'm trying without using multiple tables.. Perhaps the easier way is using a single table but I can't figure out how to do it yet
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    One thing you could do is to have a generic table, and the randomization is done with a group of rules that does a Copy Table of one of the other tables into the generic table. Then all the other logic needed to read from a table points to the generic table.
  • zoidbergsghostzoidbergsghost Member Posts: 6
    Brilliant, that seems to work great!
Sign In or Register to comment.