Sk8-tEr
New Member
- Reaction score
- 5
Any1 know where a tutorial that describes arrays is?
Or you can explain it, either way. +rep
Or you can explain it, either way. +rep
It seems that the explanation I gave you has been shredded to bits by the passage of time, CaptDeath
--off topic---
wtf did i do?
array -> type unit
variable 1 -> type unit
variable 2 -> type unit
variable 3 -> type unit
....
variable N -> type unit
array:
Unit[0] -> the first variable in the array
Unit[1] -> the second
Unit[2] -> the third
Unit[3] -> the fourth
Unit[4] -> the fifth
In this example three variables will be store in an array variable
var1(type Unit) = Peasant 1
var2(type Unit) = Peasant 2
var3(type Unit) = Peasant 3
var4(type String) = "some string"
array(type Unit)
Set Unit[0] = var1
Set Unit[1] = var2
Set Unit[2] = var3
Set Unit[3] = var4 <- impossible, var4 must be of type Unit to be stored in array of type unit
It is not neccessery to store variables in array, you can store values as well like
Set Unit[3] = Random Unit from Unit group
Set Unit[3] = Random point in region<- impossibe, cannot store variable of type point in array of type unit
If you want to call a variable from an array:
anyvar(type unit)
anyvar = Unit[1]
anyvar(type String)
anyvar = Unit[1] <- impossible cannot store value from array of type unit in variable of type string
If you want to use a value from an array in some function:
example function -> Unit - Remove
Unit - Remove Unit[1] from the game
Game- Send message to all players Unit[1] <- impossible ....