HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Set Var to Array String?

08-17-2007, 02:26 AM#1
PenguinEmperor
Hello again!

How does one go about setting a variable to the number string of an array variable?

IE; you could have an Array Var that has 13 integers stored away. I need to set my var to the number string of whichever integer is being refrenced through a different trigger.
08-17-2007, 03:58 AM#2
Vexorian
I really don't understand this one.

what's a number string?
08-17-2007, 05:29 AM#3
PenguinEmperor
For examply, when you make an array, it will always have [gen] appearing after it. You set this to a number. I need to set a variable number to the same number I set [gen] to.
08-17-2007, 05:46 AM#4
Tide-Arc Ephemera
Why don't you just store the number on an integer?
08-17-2007, 06:33 AM#5
PenguinEmperor
...

THAT'S FREAKING WHAT I'M TRYING TO DO!
08-17-2007, 06:46 AM#6
Tide-Arc Ephemera
Oh... I misread... I don't mean to be dumb... but could any further expansion on what's already been said be given?
08-19-2007, 12:09 PM#7
Pyrogasm
Yeah... I don't really get what your problem is either...
08-19-2007, 12:16 PM#8
NightBreeze
He wants to set a variable to the index of the 'referenced' integer inside the array variable.

array: 3, 5, 6, 2, 7, 1, 8
referenced integer: 7
var x = 4

Correct me if I'm wrong, it is a bit vague mate :)

Anyway, if every integer occurs only once inside the array, you could just loop through the array, increase an integer i by 1 every iteration and check if array[i] is the reference integer. If it is, end the loop and i will be the index inside the array.

If you want to store your [gen], you'll need to store it the moment you fill that slot. It's either that or array iteration.


For future reference: "number string" = variable used to specify the index of the array slot.