How do I use concatenated text?


#1

Hello all.

So, I was reviewing the Advanced Choicescript page and ran across a mention of “concatenated text:”

You can join text together like this: *set murder “red”&“rum”

I’m intrigued by the implications of this trick, but I don’t think I understand it.
Has anyone ever used this, and if so, why? What is the benefit of connecting text in this way?


#2

You can use it to display a full name, so you can ask their first name, then their surname, and then *set fullname “firstname”&“surname”


#3

You could be joining together titles.

*set title "Dr. "&name

You could be adding to a list.

*set inventory inventory&", Rusty Crowbar"

And light FairyGodfeather said, joining names.

Really, the benefits/uses are however well you use them, and how you prefer them.


#4

Aha, that makes sense. Thank you both for the quick responses. I’m going to test this a little and practice.


#5

Is it possible to add a string/text to an existing string variable in the same way one would with an array? like in javascript with push()

Basically i want to be able to add more text to a variable called “story so far” where every so often there will be pieces of the plot that has occurred over the course of the game added to the same text string. This is so the player who may not finish the story but resumes weeks later is able to have a recap of events so far in the game as a refresher etc. This isn’t so much as listing all choices made, but rather a paragraph at a time is added more to do with plot than anything else.

I am not sure if this is possible in COG? obviously one problem might be needing page breaks in between to avoid the wall of text problem.

*edit: Ok I got this working with (Note the story plot is a little more interesting than blah blah)

*set plot_so_far (plot_so_far)&("Blah blah, blah.")

Any ideas how I could add some line breaks?