6 – Using Tables

This Tutorial will walk through how to use Tables in GameSalad.

First, let’s create a table.

Navigate to the “Tables” tab in the Library
Click the + sign in the top right of the screen.
Windows Creator is currently limited to a maximum of 100 tables in any project. 

Now, let’s Edit the table.

Double click on the table you just created.  This will open up your editor in the Backstage. To the right of the words “Rows” and “Columns”, there is a numerical value in an editable box.  Click the box to change the value, and enter the number of Rows or Columns you’d like to have.

You’ll see each column in your table has a drop-down menu where you can select an attribute type.  To change the type of column, select the drop down arrow and click on the type of attribute you’d like.  If you start with one type of data and change it later, GameSalad will attempt to convert all of the cells in that column to the new attribute data type.

To add information to a cell, make sure you’ve selected a column / attribute type, as well as set a number of rows you would like to utilize.  Simply click on the cell and begin typing.

Please Note: You CANNOT type in a row/column if its location exceeds your max number of rows or columns.

To Import a .csv file into GameSalad, navigate to the table you would like to import information to, and open it.  Click the “Import CSV” button at the top right corner.  Select the CSV you would like to import, and click “Open”.

Select the type of information you’re importing and click “Import”.

Using the Data in your Table

To utilize your newly added table data:

Navigate to the actor you would like to reference the data, and give it a behavior or rule that utilizes the expression editor.

Click on the “e” to open the expression editor.

Click the “Insert Function” drop down menu.

Click the “TableCellValue” function

Within the function tableCellValue(table,row,col) you can now enter the information accordingly.  Navigate to the Game Attributes Browser and specify which of your Tables to use in the first “table” coordinate.  Specify the row and column coordinates.  Please note that these can be modified and randomized by using additional functions and attribute references.

Additional Table Functions

There are two additional table functions that can be used to gather table information.

  1. “TableColCount” is used to get the maximum number of columns in the specified “table” field
  2. “TableRowCount” is used to get the maximum number of rows in the specified “table” field
These two functions are very helpful for pulling random data from the table, allowing the range of values to be highly customizable.