OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lihamatti on 12 Jul 2004, 20:47:49

Title: How to put values in a vektor?
Post 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
Title: Re:How to put values in a vektor?
Post by: ponq on 12 Jul 2004, 20:59:12
Uhm, with vektor you mean array?
Title: Re:How to put values in a vektor?
Post by: Lihamatti on 12 Jul 2004, 21:09:34
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.
Title: Re:How to put values in a vektor?
Post by: macguba on 12 Jul 2004, 23:02:25
Yes, in this context vektor=array.    (You could also call it a matrix if you wanted.)
Title: Re:How to put values in a vektor?
Post by: Sui on 13 Jul 2004, 09:27:12
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 ;)
Title: Re:How to put values in a vektor?
Post by: Lihamatti on 13 Jul 2004, 11:46:37
Cool!, thanks a lot Sui!