It looks like you're new here. If you want to get involved, click one of these buttons!
<<set $npcs to { barkeeper:{name: "Unknown", interaction: 0, aff: "", related:"", remarks:"", visible:false, }, waitress:{name: "Unknown", interaction: 0, aff: "", related:"", remarks:"", visible: false,} }>>
<<set $npcs["barkeeper"].name to "Ric">>Which works fine when it's a just a name, for example.
$npcs["barkeeper"].remarksI would like to add multiple sentences. My intention, was that during the game, when you discovered a new detail about the character I would add it to this variable so that it could be displayed later. Something like "he likes beer", "he does not like blonds", and so on and on. Now this may be a totally dumb question, but I don't know how to add new sentences to the array, only set it as something completely new.
Comments
1. Make sure to initialize the array. The best way is to use an empty array literal, which is an empty pair of brackets ( [] ).
2. To add items, use the <array>.push() method:
When I use the push method it creates commas in the array. Is it possible to remove them? Because I'm adding sentences and having them ending with a dot and then a comma just looks weird... (e.g."Likes beer.,Does not like blonds."). It's just a small whim of mine...
Try something like the following instead, which uses the <Array>.join() method to convert the array into a string with a separator of your choosing: The quotes in the above contain a single space.