Add row at the beginning of a table
I have one table, where it initially only has 1 row. The table is used to determine the cost and the effects whenever users upgrade.
For example the initial value for cost in the table is 500. Then users upgrade for the cost of 500, at the same time I add a row at the beginning, and increment the value of 500 by 10%, so there are now two rows (first row = 500*110% = 550, second row = 500), so when users want to upgrade again, it will cost them 550 (value in 1st row). The table will be added one row at the beginning whenever users upgrade.
My question is, when my table reaches a number of 100 rows, will this method works? I mean, will it add a row at the beginning and 'kick out' the last row (the 100th row)? Or will it not work when it reaches 100 rows?
Thanks.
Best Answers
-
Summation Posts: 476
@tatiang said:
Summation As this was posted to the Mac subforum, I assumed the person was using a Mac and therefore not limited in that way but thank you for bringing that up because perhaps pokapola is using a PC...?Summation Do you know what happens if you add a new row to the beginning of a 100 row table?
I made a demo with two actors and one table with 100 rows and 1 column.
Actor 1 is set to display the value of table 1, row 1, column 1 (this is a text string: "Row One")
Additionally, Actor 1 is set to add a row to table 1 on touch.Actor 2 is set to display the value of table 1, row 100, column 1 (this is a text string: "Row 100")
In the viewer, these two actors display their respective strings as intended.
However, when I press Actor 1, no text displays in Actors 1 or 2.
But the viewer does not crash.
Answers
@pokapola You could always point your equation to a second (or third, etc) table...?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
One way to know for sure is to try it. But generally speaking you should be able to add a row to the beginning of a table as many times as you want. I'm not sure why you picked 100 rows but it could just as easily be 1,000 or 10,000 rows. The table will expand by one row each time to accommodate the new beginning row.
You might consider not using a table at all. If you are increasing by 10% every single upgrade, you could just use a mathematical formula/expression and forget about the table altogether:
Constrain Attribute game.cost to game.cost*1.1^game.upgradeLevel
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang With the windows version at least, even with Pro and even if you're signed in, you cannot create a table with over 100 rows or 100 columns.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
@Summation As this was posted to the Mac subforum, I assumed the person was using a Mac and therefore not limited in that way but thank you for bringing that up because perhaps @pokapola is using a PC...?
@Summation Do you know what happens if you add a new row to the beginning of a 100 row table?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I've not tried the windows version so can't comment specifically, but it may be like adding tables. We can't add more than 50 tables, but if you manually add one to the XML GS is perfectly happy for it to be there. I'd bet it's an interface or arbitrary limitation and as @tatiang suggests in-game it'll add as many rows as you want.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I made a third actor (Actor 3) to display the value of row 2.
When I clicked on actor 1, Actor 3 displayed "Row One" which was the initial value of row 1, column 1
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
I made a fourth actor (Actor 4) to display the value of row 101 (even though the table does not start with 101 rows).
When I clicked on actor 1, Actor 4 displayed "Row 100" which was the initial value of row 100, column 1
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
Yep, I had a similar experience (got out my dusty copy of Windows Creator). I added a row to the beginning of a 100 row table and was able to display the new row 1 value and the row 101 value correctly.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Indeed I am using Mac, sorry for the confusion. I think I read somewhere in this forum about the 100-row limitation, never thought it was only for Windows version. So it seems that I won't be having any problem then.
Thanks anyways for your responds guys @Summation @tatiang @Armelline !