Save / Load Character from tables
3itg
Member, PRO Posts: 382
I played with trying to set this up for a couple hours, but I keep getting invalid expressions when I try to recall data from my tables.
Im new but I think I have a pretty good idea of what I'm trying to do ( I have used other game engines successfully).
Would someone be willing to explain where I am going wrong?
Quick explanation of what I was trying:
from my character creation scene, I made a keyboard so the player can enter their name, this becomes the game.Name.
then I tried to save game.Name to a table (called GameSave) by creating an actor that takes the text input, changes the game.Name to match the input and then save the game.Name to the GameSave table in row1 / column 1. after saving, go to the next scene.
In my next scene, I made a test actor to attempt to display the value of row1/column1 of the GameSave table to check that the data is being saved to the table. However, I only seem to be able to get "Invalid Arguments". (I made an actor with a self.PilotName attribute, and am trying to make it equal the data from row1/column1 in a "Display Text" behavior in the actor)
So just to be succinct, What is the correct process to save a name (or other player stats) to a table to be called later?
Can you provide an example of what the actual expression looks like from the editor? (maybe for loading and saving, since I'm not sure where I'm going wrong(and yes I watched videos))
I am attempting my first larger project in game salad after being very pleased with 2 other games I was able to make in less than a week. I want to expand on the type of games I can make and I figured saving, loading character data is a good way for my audience to pick up where they left off.
If anyone who is feeling helpful needs more info, I would love to provide it to you
Im new but I think I have a pretty good idea of what I'm trying to do ( I have used other game engines successfully).
Would someone be willing to explain where I am going wrong?
Quick explanation of what I was trying:
from my character creation scene, I made a keyboard so the player can enter their name, this becomes the game.Name.
then I tried to save game.Name to a table (called GameSave) by creating an actor that takes the text input, changes the game.Name to match the input and then save the game.Name to the GameSave table in row1 / column 1. after saving, go to the next scene.
In my next scene, I made a test actor to attempt to display the value of row1/column1 of the GameSave table to check that the data is being saved to the table. However, I only seem to be able to get "Invalid Arguments". (I made an actor with a self.PilotName attribute, and am trying to make it equal the data from row1/column1 in a "Display Text" behavior in the actor)
So just to be succinct, What is the correct process to save a name (or other player stats) to a table to be called later?
Can you provide an example of what the actual expression looks like from the editor? (maybe for loading and saving, since I'm not sure where I'm going wrong(and yes I watched videos))
I am attempting my first larger project in game salad after being very pleased with 2 other games I was able to make in less than a week. I want to expand on the type of games I can make and I figured saving, loading character data is a good way for my audience to pick up where they left off.
If anyone who is feeling helpful needs more info, I would love to provide it to you
Best Answer
-
HC_DK Posts: 92I asume that you first COL is TEXT.
I have done a simple test and I used to LOCAL text attributes (Text From Table and Text To Table) and two rules.
First rule:
When Actor receives event TOUCH is PRESSED:
Change Attribute: self.Text From Table to tableCellValue(MyTable, 1, 1)
Change Attribute: self.Text To Table to tableCellValue(MyTable, 1, 1)
Keyboard Input:
Change Attribute: self.Text To Table
Keyboard Prompt: (This is used for a headline)
Second rule:
When Attribute self.Text From Table is self.Text To Table
(DO NOTHING)
Otherwise:
Change Table Value:
Row: 1
Column: 1
Value: self.Text To Table
Save Table: MyTable
The for your next scene have an actor with Display Text: tableCellValue(MyTable, 1, 1)
Hope this can help you.
HC
Answers
Also, i was typing "self." and "game." instead of using the menus to select those and that also stopped it from working
I made a demo to show text saving and loading from table works.
You can use the actor that displays the name text in any scene you want.
Just convert the name saving part to user input.
Attached a window & Mac GS file.
I`m working on that, and i think i can do a lot of things using tablets instead
Create Scene. Add attribute text name player
Create actor, collect name, input rule, when player hit, keyboard input, and set that to name player, change value table row 1 col 1 to game.nameplayer
Create actor, display text, display table and row 1 col 1
Why breaks all???
https://docs.google.com/open?id=0B1KHen0jvlLzSVBDQ1JseTN6LTQ
I have modfy that
https://docs.google.com/open?id=0B1KHen0jvlLzYXd2Y0xTb2VJNDA
Now dont breaks, because i dont repeat the attribute en game and actor values, but, still to repeat the input value for take it the final actor...
https://docs.google.com/open?id=0B1KHen0jvlLzQnlWMmFaclRfOVE
The name won't show once you key in the name because you need to separate the save to table function seperately. The conditions you stated run keyboard input and save to table at the same time so it registered a blank entry. but by using a seperate save button you will be able to see the updated name after clicking save button after you enter the name.
I use last version of it.
0.10.00 beta
@StraightSaladShooter hi not sure if it's a bug but the keyboard input doesn't work in preview . It hangs the whole GS.