GameSalad

Howdy, Stranger!

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

problem with rows

KanaSpeedKanaSpeed Posts: 4Member
edited August 2012 in Community Tutorials
Hi guys, I have a table with 1 column and 20 rows, I would like to know how I can + content of each row

example: row 1 + row 2 + row 3 ....... + Row 20 = X

and then match the result of X = a number in this case 60.

If X is = 60 result is Perfect.

thanx.

Comments

  • MotherHooseMotherHoose Posts: 2,456Member
    access the values in the table randomly or sequentially?

    gameAttribute: index type … name it X

    on the actor that controls the addition
    attribute: index type … name rowCount

    Rule: when
    condition for when rule should fire
    -either one of these behaviors
        for random:
        changeAttribute: rowCount To: tableCellValue(table,random(1,tableRowCount(table),1)
        for sequentially:
    changeAttribute: rowCount To: rowCount+1
    -changeAttribute: game.X To: game.X+tableCellValue(table,rowCount,1)

    Rule: when
    Attribute: game.X = 60
    -do this

    =
    in computing you add to a value by changing its value To: itself+additionalValue

    you will not need a table … when the player is selecting the value to add
    just change game.X To: game.X+selectedValue

    image MH
  • KanaSpeedKanaSpeed Posts: 4Member
    thanx very much !!! :)
This discussion has been closed.