table default row count is 1?
gooner
Lancaster, PAMember Posts: 135
So when adding data to a table I figured it would be similar steps to insert, edit, and commit.
However, I have an actor which displays row count of my table. It seems the row count is 1 before I add a new row. If this is correct, instead of adding a new row to fill in the cell values of the table row count, I would actually have to edit/fill-in cell values of table row count first then add a new row so next time I fill in cell values the row is already available to edit.
Does that seem correct or am I completely messing this up?
Thank You
PS - Please let me know if there are any table videos that cover the proper steps and order to add new row, edit cell values, save table, etc.
Comments
You cannot create a 0 row table. This is a bit annoying, as it means, as you note, that any logic that adds rows to a table will always start with 1 row.
I often will just delete the starting row in the table before running any other logic, ensuring a starting value of 0.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
OK, thanks. I will try the same. What logic do you use to ensure it only deletes the row the first time through?
@ellison You can create a boolean attribute called game.firstRun and set it to true. Then use this rule:
Load Attribute game.firstRun key:firstRun
When attribute game.firstRun is true
[delete first row]
Change Attribute game.firstRun to false
Save Attribute game.firstRun key:firstRun
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank You!
Is key name just a matter of typing it inside of the expression editor?
Also, is there anywhere I can view the keys that I've made and is there a way to delete unused keys(if even necessary)?
Thanks!
Yes. You can type it directly into the field in that behavior without opening the expression editor. If you do use the expression editor (I don't recommend it in this case), be sure to enclose the key name in quotes ("firstRun"). Make sure that the key in the Save Attribute behavior exactly matches the key in the Load Attribute behavior.
No. It's such a pain to deal with keys that you might consider doing what most of us do... using tables. When you store an attribute value in a table (cell), you can save an entire table with a single Save Table behavior. Tables are automatically loaded at runtime so there is no need for a load behavior and no need for any sort of key.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Tables rock!
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
thank you for the advice, I am going to rework and use a table.
I am starting to see that.
PS - appreciate the videos, first, one you attached to a previous question of mine, and I've also started watching the table videos, thanks.
Once I get my GS Logic series back up I highly recommend that one many people have credited it with give them the basis for becoming power users in GS. I may remake that series as I did before I got serious about my production quality.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Keep me/us posted. I'll definitely be checking them.