Adding Text to a Table Cell

So I have text in a table cell, and it catalogs the content of the player's inventory. So by default it says "Knife cup rope", what I would like to do is to somehow add and delete text from it in-game, so for example if the user picks up a gun, it would change the table cell to "Knife cup rope gun".

Can anyone please help? :(

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    You can do this with text string functions but honestly I'd rather use individual table cells for that purpose. In other words, you would just add a new row for each new item. Is there a reason you need it all in one string/cell?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • JoeBJoeB Member Posts: 160

    I'm making a text based adventure game and I'd like to display a text that says "[Actor A] went looking for [Actor B]" and this is dynamically generated, so I'd generally have a lot of text based behaviors for it

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I'm not sure how that fits into your question about an inventory but even with a text-based adventure, I'd recommend using individual table cells to hold unique data rather than strings with multiple data sets embedded.

    If you have a sample project file you'd like to send me (.zip it first) as a PM, I can take a look and let you know what I'd recommend for your particular application. Or if you can give a specific example beyond just a single sentence, I might have a better sense of how you're trying to incorporate table/string data into the displayed text.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited November 2014

    I agree with @tatiang about using multiple cells in a table (instead of a single cell) to store text items. However, for the sake of showing how its done, attached is one way to insert, add to, replace, and delete single text items (words) in a single table cell.

  • JoeBJoeB Member Posts: 160

    Wow, thank you to both! @RThurman‌ @tatiang‌ that helped a lot! I will also use the multiple cell tables but for different attributes.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    You're welcome. I also was going to mention my drop-down menus demo that has an inventory system as well.

    https://forums.gamesalad.com/discussion/comment/461526/#Comment_461526

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.