Fun with Arrays

With Arrays now being a thing my mind has been running wild with how I can redue my WIP. I fear that it might be too late though. I’m rather far in.

However here is something we can now do with ease. The thought is to define which slots are always going to be for. Then instead of always remembering which slot the stat would be in, you just call for the variable assigned to it.

*create Name 1
*create Strength 2
*create Agility 3
*create Health 4
*create Stamina 5
*create CharacterFocus "MainCharactersStats_"
*create_array MainCharacterStats 5 0

*set {CharacterFocus&Strength} +15
*set {CharacterFocus&Agility} +10
*set {CharacterFocus&Health} +25
*set {CharacterFocus&Stamina} +10

I have not tested it yet. However this will allow you to organize different stats and will be able to call for them with ease. More so when players have an option to have different people for the same scene. This can go beyond just statistics. You can store other pieces of information.


Choicescript doesn’t support the += operator. And Im not sure but I don’t think you can use *set like that. Although you do have a command called *setref.

I don’t understand why you would like to complicate things like that. The use cases for arrays are the same. The new command just makes it easier to create arrays. Becareful not to use it just because and make things more complicated without an actual gain.

If you’re going about using arrays to simulate objects than you might check these out:

You’re right with the +=. I have corrected that. You are able to use *set in that manner.

I admit my presentation was a bit over the top, but the point was that we can easily set Arrays and that we can define variables to make sure we keep them organized if you want to have ‘party memebers’ that each have their own statistics.

In this specific example it would be used when the writer is giving the reader the option to select different characters to help with things. It would allow the writer to have a party with dynamic changing stats.

Lets say they wanted a thief they are working with pick a lock, they could use this set up to find the statistics for said thief. However what if, due to story choices, the thief isn’t in the party. You could use the same code to select someone else after changing who the ‘focus’ variable is.

Sure, but you could already do that. What changes with the new command?