different types of numbers

Is there a way you can make it so an a value of something can be several different types of numbers? As in lets say I wanted an attribute to be either equal to 1, 5, 20, 14, or 23. How could I do that?

Having trouble with your game? Sounds like a personal problem.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    Stick the numbers in a table and select them from that.
  • ADSentertainmentADSentertainment Member Posts: 397
    Stick the numbers in a table and select them from that.
    I'm a bit new with tables, would it be possible for you to give me an example or video on how to do this?

    Having trouble with your game? Sounds like a personal problem.

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2013
    Google / Youtube: 'GameSalad tabels'

    There are a lot of videos out there . . . Start with this one:

  • ADSentertainmentADSentertainment Member Posts: 397
    edited March 2013
    Google / Youtube: 'GameSalad tabels'

    There are a lot of videos out there . . . Start with this one:

    Alright, thank you! :)

    Having trouble with your game? Sounds like a personal problem.

  • ADSentertainmentADSentertainment Member Posts: 397
    edited March 2013
    Google / Youtube: 'GameSalad tabels'

    There are a lot of videos out there . . . Start with this one:

    I watched the video, and I think I did what it said, but I keep getting the number zero. I'm trying to get an object to move in different directions, the angle of each direction I want is on a table. here's the code:

    tableCellValue( game.TB angles ,random(1,tableRowCount( game.TB angles )),1)

    the numbers I have in the table are:

    160
    20
    30
    40
    150
    140
    130

    all of them are in one column. Do you know what I'm doing wrong?

    Having trouble with your game? Sounds like a personal problem.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You have it set up correctly. Did you select the table name from the menu in both cases rather than typing it in?

    Can you post a screenshot of your rules?

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

  • ADSentertainmentADSentertainment Member Posts: 397
    You have it set up correctly. Did you select the table name from the menu in both cases rather than typing it in?

    Can you post a screenshot of your rules?
    I did not type it in, although I think it would be useful if you could. Here's a screenshot of what I did:

    photo ScreenShot2013-03-30at12149PM_zpsaf368178.png

    Here's a screenshot of the table in case you need to look at that too:

    photo ScreenShot2013-03-30at12655PM_zps684e4c9d.png

    Having trouble with your game? Sounds like a personal problem.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Yep, still looks right. If I had to guess I'd say that using a random number function and a row count function inside of a tableCellValue function is your problem. I know other people have said that can work, but I'd recommend (at least for debugging statements) that you separate everything out:

    Change Attribute self.Rows to tableRowCount(tableName)
    Change Attribute self.Random to random(1,self.Rows)
    Change Attribute self.Direction to tableCellValue(tableName,self.Random,1)

    Does that work?

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

  • SocksSocks London, UK.Member Posts: 12,822
    Yep, still looks right. If I had to guess I'd say that using a random number function and a row count function inside of a tableCellValue function is your problem.
    Yep, you are often better off generating the random number outside of an expression.

    So rather than:

    If X then do Y*(random 1,10)

    Try:

    Make A = (random 1,10)
    If X then do Y*(A)
  • lewisonelewisone Member Posts: 48
    tables are a great way, I might even do it dumbed up a bit and in a rule say when attribute is equal to a number , and add as many or conditions as you like to be equal to other things as well... Just a thought.

    -LewisOne (My Website, FB, Twitter, IG, YT)

Sign In or Register to comment.