Jump to content
  • 0

Attaching array to character?


jasonch

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   1
  • Joined:  12/31/11
  • Last Seen:  

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?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

use character permanent variable

setarray arrayname[0], 1,2,3,4,5;
setarray arrayname$[0],"1","2","3","4","5";

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   1
  • Joined:  12/31/11
  • Last Seen:  

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....
 

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

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 :)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  120
  • Reputation:   48
  • Joined:  07/23/13
  • Last Seen:  

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?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   1
  • Joined:  12/31/11
  • Last Seen:  

@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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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

Link to comment
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.   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.

×
×
  • Create New...