TableColSum, how long does it take.
I have 3 tables, 320 columns in total. And all these columns need to be summed everytime players open the game.
What I did is, I used TableColSum to change 3 game level attributes, Sum1=TableColSum for Table 1, Sum2=TableColSum for Table 2 and Sum3=TableColSum for Table 3. And then when the game enters the main scene, these 3 attributes are added together.
The problem is, I delay the splash screen (where TableColSums are) by 10 seconds, and it seems that the function does not seem to work. It did return return some values though, but a negative value (all values in columns are positive).
My question is, is there any ways to check whether the calculations (TableColSum) have been done up to the last columns? Do 10 seconds is not llong enough to sum 320 columns from 3 tables?
Comments
Oh just to add, I did think of summing up all the columns manually,by incrementing n, and the sum it up by adding game.SumTable+TableCellValue(Table,n,1) but is just seems to be a good waste of the TableColSum function.
Doing such a calculation should only take a fraction of a second so there is something wrong with your logic. Try this: after the sum1, sum2, sum3 that calculates the TableColSums then add a 0.2 sec delay before you're doing sum4=sum1+sum2+sum3.
Add some display text to the scene that shows the values from the four attributes (game.sum1 etc) so that you can see the values directly (for debugging purpose)
Are you using a Loop or some other method to sum all of those columns? It may be that you're not letting the loop finish. You may also have an error in your tableColSum expressions. Can you post them? You should be able to copy and paste from the expression editor (at least on a Mac).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I ditched the TableColSum function, and sum all the columns in all of the tables manually, it works, I did not alter any existing logic except for adding Loops behaviours and deleting the TableColSum.
Don't know what's wrong with TableColSum
There is nothing wrong with TableColSum I use it all the time
Make sure you are not using a row out of bounds of the table in the tableColSum function. Also it will run much faster than summing each value manually
If you try to run tableColSum on 320 columns simultaneously, it'll not happen instantly. (Nothing being done 320 simultaneously will.) That said, 10 seconds should be way more than you need to do that. I'd definitely be checking what @zweg25 mentioned first.
Perhaps post a sample table (same number of rows and columns, can be random numbers in it) here so people can run quick tests of their own.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Guys, I have ditched the TableColSum function, and I sum all the rows manually instead, and it works just like it should work.
I don't know it didn't work with TableColSum, maybe it's a bug?
Good for you
Or maybe it's just your logic since everyone else in this thread seems to have no issue with it?
Possible, but most likely is you were using TableColSum slightly wrongly, as @JSproject says. 19/20 it's a logic issue rather than a GS bug
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support