Appie78 Posted September 25, 2008 Posted September 25, 2008 Hello everyone, I've got a little problem with my script due to an array. I've got 2 fixed array (x and Y coordinats). CODEFunc Pos() Dim $arrx[5], $arry[5] $arrx[0] = "0" $arrx[1] = "1" $arrx[2] = "2" $arrx[3] = "3" $arrx[4] = "4" $arry[0] = "0" $arry[1] = "1" $arry[2] = "2" $arry[3] = "3" $arry[4] = "4" For $i = 0 to GUICtrlRead($stubs) Step 1 $x = $arrx[$i] $y = $arry[$i] $i = $i + 1 scansample() Next EndFunc The X is changing value but the Y isn't. Can anyone help me? Thanks, Pokerface Electron microscopes rule!!!
Community On Patrol Posted September 25, 2008 Posted September 25, 2008 Hi Pokerface, Doing a search of your topic, it's been found many times with the search feature or is listed as a non-descriptive topic. Please do a search before posting new thread topics. And please use descriptive topics so that others that do use the search feature may also find what they are seeking. (You'll also find that using descriptive topics, will get people in your thread that know how to answer your questions, those same people ignore non-descriptive topics). Thanks.
Andreik Posted September 25, 2008 Posted September 25, 2008 (edited) Hello everyone, I've got a little problem with my script due to an array. I've got 2 fixed array (x and Y coordinats). CODEFunc Pos() Dim $arrx[5], $arry[5] $arrx[0] = "0" $arrx[1] = "1" $arrx[2] = "2" $arrx[3] = "3" $arrx[4] = "4" $arry[0] = "0" $arry[1] = "1" $arry[2] = "2" $arry[3] = "3" $arry[4] = "4" For $i = 0 to GUICtrlRead($stubs) Step 1 $x = $arrx[$i] $y = $arry[$i] $i = $i + 1 scansample() Next EndFunc The X is changing value but the Y isn't. Can anyone help me? Thanks, Pokerface I put some comments of code: Func Pos() ;~ $arrx is the same as $arry in this case use only one array ($array) Dim $array[5] $array[0] = "0" $array[1] = "1" $array[2] = "2" $array[3] = "3" $array[4] = "4" For $i = 0 to UBound($array)-1; use UBound if you want to get dimension of array (I think that GUICtrlRead($stubs) is array dimension) $x = $array[$i] $y = $array[$i] ;~ here you are in a for loop, you don't need to increment ($i = $i + 1) because in loop $i is autoincrement scansample() Next EndFunc Edited September 25, 2008 by Andreik
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now