Jump to content
  • 0
bWolfie

Set variable called from defined array?

Question

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.

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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

Edited by meko

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.