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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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