Inventory and tables
mrchris317
Member Posts: 78
I would like to create an app that keeps track of items you have at home. For example, I would have
Lamp- 2
Bed- 3
Table - 1
So I want to give the player all the items and then they input how many they have for easy recall. I also want to group the objects (kitchen stuff, bathroom stuff, etc.).
Is there a way to do this using tables? Finally, I would like to import this data from a list I complied, is there a way to do that too?
Thank you,
Chris
Lamp- 2
Bed- 3
Table - 1
So I want to give the player all the items and then they input how many they have for easy recall. I also want to group the objects (kitchen stuff, bathroom stuff, etc.).
Is there a way to do this using tables? Finally, I would like to import this data from a list I complied, is there a way to do that too?
Thank you,
Chris
Answers
Change Table Value
Table: tableName
Row: game.itemType
Column: 1
Where game.itemType is the name of the item, such as "Lamp" (with quotes in the expression editor).
Keyboard input is tricky because you can't convert text to numbers. You'd have to have counter arrows (less/more) to allow the player to change the count for each item.
And you can import tables from csv files. You just can't import/export the column labels. Those have to be added manually in GameSalad.
You can certainly group items, but you'll have to decide how to do that. For example, you might do Change Attribute game.KitchenStuffCount to tableCellValue(tableName,"Lamp",1)+tableCellValue(tableName,"Bed",1)+tableCellValue(tableName,"Table",1).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
For example, I click kitchen, then all kitchen items come up.
Microwave would be first on the list.
Next to microwave there would be an input box and I can click it and enter 4, 10, 100 etc.
I know you said I can do up and down arrows, but can the person input the number themselves?
Thank you for your help:)
Chris
How would the person input the number themselves? The Keyboard Input behavior allows for storing a text attribute. Since you can't convert text to integer, there is no way to do that. You could create a custom keyboard where each letter or number is an actor and when you press 3, you increase the number of lamps or whatever by 3. Of course, if they then press 7, you have to convert the 3 to 30 and add 7 to it. If they then press 4, you have to convert the 3 to 300, the 7 to 70, and add 4 to it. Make sense? You'd also want a button to clear the number back to 0 in case they make a mistake.
To get you started, here's a demo of your initial question:
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User