Set variable called from defined array?

bWolfie

I'm the man
Messages
850
Points
0
Location
Alberta, Midgard
Github
bWolfie
Emulator
Hello,

I want to set a permanent character variable that calls from an array.

For example, my variable set up:

    setarray(variable$[0],
        "value_1",
        "value_2",
        "value_3"
    );


 And then call array to set the variable:

        variable$[2] = 1;


It seems to work okay...but when scripts reload, values are cleared.

Any help? Thanks.

 
setarray() does not create the structure of the array; it sets multiple elements of the array at the same time.

this means every time setarray() is called it will overwrite the values.

arrays do not need to be declared. every variable is always implicitly an array

Also, there's another problem: variable$[2] = 1;

You are setting an integer as value of a string variable

If what you need is an array of integers then remove the "$" in the variable name

 
Last edited by a moderator:
Back
Top