table search function inside of a random function

hi there. i am trying to streamline my code and was wondering if anyone have tried using a table search function inside of a random function?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It should work as long as it's a small table. I would imagine the random function parameters would be evaluated extremely quickly but perhaps adding a tableSearch function inside would cause it to pause for evaluation? I'm doubtful so you'll just have to try it.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Honestly, it's better to just separate out the evaluations:

    Change attribute game.foundRow to tableSearch(blah blah blah)
    Change attribute game.randomResult to random(1,game.foundRow)

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

Sign In or Register to comment.