Jump to content
  • 0

Attaching array to character?


Question

Posted

Hey guys, am here again!

A short question: Is there a way to attach an array to a character permanently? And how do you call each variable?

6 answers to this question

Recommended Posts

  • 0
Posted

Hmmm, should've made myself clearer. Sorry. What I actually wanted is that the character has the ability to choose what value to set for each value on the the array.

For example: The character chooses on a menu the value "2" on the an array "arrayname[0]", then chooses again "3" on arrayname[1], 1 on arrayname[2], and so on...
Then it will attach to the char: arrayname[0], 2, 3, 1,.....

Is it possible? And how do I call that values attach to the char? So the NPC will say: You chose values 2, 3 ,1, so on....
 

  • 0
Posted

You want to look into the input command

As far r how to set each array[index] you would do something like

Input(Var[index]);

should work

 

 

This is a support thread so I'll support you in finding an answer :)

  • 0
Posted
On ‎8‎/‎24‎/‎2017 at 6:36 PM, jasonch said:

Hmmm, should've made myself clearer. Sorry. What I actually wanted is that the character has the ability to choose what value to set for each value on the the array.

For example: The character chooses on a menu the value "2" on the an array "arrayname[0]", then chooses again "3" on arrayname[1], 1 on arrayname[2], and so on...
Then it will attach to the char: arrayname[0], 2, 3, 1,.....

Is it possible? And how do I call that values attach to the char? So the NPC will say: You chose values 2, 3 ,1, so on....
 

From your comment I think what you want are each character can define their own array order but not attaching array to character.
So player A may have arrayname,2,3,1;
Player B may have arrayname,3,1,2;
Is this what you want or am I wrong?

  • 0
Posted

@yuchininYes: each and every character all can have different arrays to their desires AND it is attached to them permanently.

I've tried @Stolao's suggestion, In my char_reg_num table, I've noticed the multiple same values under KEY but under INDEX, they're being numbered. Is this how array being registered in the database? If it is, then I guess my questions are answered.

  • 0
Posted

Yes, the array is registered with the following information

 

char_id | name of variable | index of array | value

 

so for instance, if you create array on character: 

setarray charArray[0], 1, 2, 3;

you will have 3 values for 1 character...

150001 | charArray | 0 | 1

150001 | charArray | 1 | 2

150001 | charArray | 2 | 3

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...