OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lihamatti on 12 Jul 2004, 20:47:49
-
Sorry if this has been asked before, but how can I put/change values of a vektor. For example if I have a vektor _vek = [1,2,3,4], how can I change number 3 to number 7 (with a scripting command)? like: _vek select 2 = 7 . That doesn't work but you get what I mean. Thanks
-
Uhm, with vektor you mean array?
-
Hmmm, I guess so, I'm kind a new to this whole scripting. I need a list of numbers which will be changed (one at a time) during running the script.
-
Yes, in this context vektor=array. (You could also call it a matrix if you wanted.)
-
You can change a single element of an array with the set command. eg.
Array set [ element, value ]
So in the above example:
_vek set [2,7]
Just note that the first element in an array is numbered zero. So in your example, 1 is element 0, 2 is element 1, 3 is element 2 etc.
Bit of a pain for those of us that start counting at one :P ;)
-
Cool!, thanks a lot Sui!