Can you use tablecellvalue in a rule?

Every time I try to use tablecellvalue in a rule (ex. if attribute = tablecellvalue(table,y,x)) and hit the previewer, it just goes crazy? like I don't even know how to describe it, it just doesn't work, the game doesn't even open and it almost makes gamesalad crash. Is this a gamesalad bug or am I not supposed to do that?

Btw this is the latest version of gamesalad windows

Comments

  • bernardo.chuecosbernardo.chuecos Member, PRO Posts: 75

    btw this does not happen in the web previewer

  • owen_dennisowen_dennis Just a guy, you know. Member, PRO Posts: 236

    Are you referencing a table cell that doesn't exist? Like it's a table that doesn't exist or like a row or column that isn't there?

  • bernardo.chuecosbernardo.chuecos Member, PRO Posts: 75

    @owen_dennis said:
    Are you referencing a table cell that doesn't exist? Like it's a table that doesn't exist or like a row or column that isn't there?

    Well the table starts as a 10*1 and then as soon as the game starts all the new rows are created. Could that be it?

  • owen_dennisowen_dennis Just a guy, you know. Member, PRO Posts: 236
    edited September 2015

    It's possible, assuming the rows are being created after the reference is supposed to happen. If the reference to the table row happens first, and those rows aren't there yet, then it's referencing nothing.

    So I guess it depends on what's making the rows. If those rows get made in that actor before the actor starts referencing, that should fix it. However, if it's made in a different actor, you have to make sure that that actor is above the other actor in the layer in the scene they're in (if they're both on the same layer) so that it fires before the actor that references those rows. Alternately, if the actor that's making those rows is on a different layer, make sure its layer is below the layer of the actor that's trying to reference stuff.

    Gamesalad makes things in the scene start firing from the bottom layer first, then it goes from the top of that layer down through the layer, then on to the next layer above it and so on.

  • bernardo.chuecosbernardo.chuecos Member, PRO Posts: 75

    @owen_dennis said:
    It's possible, assuming the rows are being created after the reference is supposed to happen. If the reference to the table row happens first, and those rows aren't there yet, then it's referencing nothing.

    So I guess it depends on what's making the rows. If those rows get made in that actor before the actor starts referencing, that should fix it. However, if it's made in a different actor, you have to make sure that that actor is above the other actor in the layer in the scene they're in (if they're both on the same layer) so that it fires before the actor that references those rows. Alternately, if the actor that's making those rows is on a different layer, make sure its layer is below the layer of the actor that's trying to reference stuff.

    Gamesalad makes things in the scene start firing from the bottom layer first, then it goes from the top of that layer down through the layer, then on to the next layer above it and so on.

    Well I just tried to have the tables made up from the beginning rather than starting them off as 10*1 and then adding the rows, but it's not fixing the problem it still will not load my game and the problem is only fix when I remove "tablecellvalue" from all my rules

  • bernardo.chuecosbernardo.chuecos Member, PRO Posts: 75
    edited September 2015

    @bernardo.chuecos said:
    Well I just tried to have the tables made up from the beginning rather than starting them off as 10*1 and then adding the rows, but it's not fixing the problem it still will not load my game and the problem is only fix when I remove "tablecellvalue" from all my rules

    Actually, I stand corrected. The game does load now, but now the scene after the logo scene does not load, and for some reason this if fixed when tablecellvalue is not in any of my rules

  • bernardo.chuecosbernardo.chuecos Member, PRO Posts: 75

    Okay sooo I just fixed the problem by putting those tablecellvalue rules in a timer so that they don't start acting until the scene has loaded. Don't even ask me why that worked, I'm so confused right now.

  • bernardo.chuecosbernardo.chuecos Member, PRO Posts: 75

    There is a loop at the beginning of my scene, and after that loop finishes then the tablecellvalue rules don't cause trouble anymore. But the loop and the rules are not even related, they don't even share attributes so I don't understand the problem between them

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited September 2015

    That's because the value is less than 1 for your row/column value. You can't access a row/column that doesn't exist and there is no zero. To avoid this you wrap those rule that say when attribute or attributes you use to define the row/column numbers are > 0

  • pHghostpHghost London, UKMember Posts: 2,342

    Does your loop by any chance create the rows?

    If so, there's your problem. The tableCellValue tries to reference cells before the loop has finished.

  • bernardo.chuecosbernardo.chuecos Member, PRO Posts: 75

    @pHghost said:
    Does your loop by any chance create the rows?

    If so, there's your problem. The tableCellValue tries to reference cells before the loop has finished.

    it used to, but then I changed it so that the rows were already there. There are other loops at the beginning of the scene that still interfere though.

Sign In or Register to comment.