Making rules with table values?

Hello i´m trying to make a comparison about...


Rule
----
Attribute: tableCellValue(game.mytable,row,colum) = 0

then make anything


But is imposible with GS. Any idea or solution if i want to have everything in tables and i want to save memory?
Regards ;)

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2013
    GameSalad does not currently support table expressions on the left side of a rule condition. There are two workarounds:

    1. Create an integer attribute called game.ZERO and make its value zero. Then use game.ZERO on the left side of the rule condition and a tableCellValue expression on the right side.

    2. Create an attribute that matches the table cell type (e.g. if you have integer cells, make it an integer attribute; if you have real cells, make it a real attribute, etc.). Assign the value of the tableCellValue to that attribute before the rule:

    Change/Constrain Attribute game.theCell to tableCellValue(game.mytable,row,column)
    When attribute game.theCell = 0
         [behaviors]


    The next version of GameSalad should have left-side table expression compatibility.
  • RubiWorksRubiWorks Member Posts: 130
    Thanks so much dear @tatiang :) I making that when i thinking in my question.


    1.Make an attribute called game.cellvalue or actor.cellvalue.

    2. Constrain game.cellvalue to tableCellValue(game.mytable,row,colum).

    3. Use game.cellvalue as a tableCellValue(game.mytable,row,colum) in the rule.


    The problem is that i´m noob about what is the best way to save memory and optimize a game then maybe i use a lot of resourses ;)

    A bigger hug :)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Don't worry too much about resources. Tables are a great way to store data. And both saving and loading table data is very easy. There are good videos available if you Google gamesalad tables.
Sign In or Register to comment.