Character array variable

jupeto

New member
Messages
39
Points
0
Github
jupeto
I don't know if I'm doing this right

So I have a collection of character variable like so;

variable_one[0] = value_one
variable_two[0] = value_two
variable_three[0] = value_three


then I'm trying to push some data to it

variable_one[getarraysize(variable_one)] = value_one_point_one
variable_two[getarraysize(variable_two)] = value_two_point_one
variable_three[getarraysize(variable_three)] = value_three_point_one


I can see that it saves to my database 

but when I try to access it and loop like this

for (.@i = 0; .@i < getarraysize(variable_one); .@i++) {
mes variable_one[.@i];
}
end;




the result is only one value

 
Last edited by a moderator:
.@i < getarraysize(variable_one)

You want to review the control part of your FOR loop.

You also, may want to review the overall logic of your code...

I don't have time right now to go over Hercules's scripting Syntax and see how arrays are built there.

But, there is something about your code, that confuses me...

 
Last edited by a moderator:
variable_one[getarraysize(variable_one)] = value_one_point_one
variable_two[getarraysize(variable_two)] = value_two_point_one
variable_three[getarraysize(variable_three)] = value_three_point_one


I think you need these the other way around? E.g.

JobLevel = .@joblevel;


Would make your JobLevel = whatever .@joblevel is.

So when saving

variable_one[getarraysize(variable_one)] = value_one_point_one

v1[3] would mean whatever the third index of variable one is, is now equal to value point 1.

 
Back
Top