aa2zz6 Posted July 3, 2015 Share Posted July 3, 2015 How would I make an array on an If statement that (rand) choose between two different MouseClickDrag[One going Up to Down] And another doing [Right to Left].If IsArray($pixel) = False Thensomehow use an array to pick eitherMouseClickDrag("left", 594, 113, 631, 656 <<== Up to DownMouseClickDrag("left", 1162, 306, 200, 315) <<=== Left to Right Link to comment Share on other sites More sharing options...
rizaado Posted July 3, 2015 Share Posted July 3, 2015 (edited) I don't understand the question much. You can shuffle the array? Visual Basic:Translate this code in Autoit...Shared Sub shuffleArray(ByVal InArray() As Object) 'byval=byref when we have array Dim N As Long Dim Temp As Object Dim J As Long Randomize() For N = LBound(InArray) To UBound(InArray) J = CLng(((UBound(InArray) - N) * Rnd()) + N) If N <> J Then Temp = InArray(N) InArray(N) = InArray(J) InArray(J) = Temp End If Next N End Sub Edited July 3, 2015 by rizaado Link to comment Share on other sites More sharing options...
Venix Posted July 3, 2015 Share Posted July 3, 2015 (edited) Switch Random(0, 1, 1) Case 0 ;Some Code Case 1 ;Some Code EndSwitchIf you just want to select randomly between multiple options would something like this not work? Edited July 3, 2015 by Venix Code Error Link to comment Share on other sites More sharing options...
rizaado Posted July 3, 2015 Share Posted July 3, 2015 #include <Array.au3> Local $aArray_Base[10] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] _ArrayDisplay($aArray_Base, "1D - Original", Default, 8) Local $aArray = $aArray_Base _ArrayShuffle($aArray) _ArrayDisplay($aArray, "1D - Shuffled", Default, 8) $aArray = $aArray_Base _ArrayShuffle($aArray, 3, 8) _ArrayDisplay($aArray, "1D - Shuffled - 3-8 ", Default, 8) Local $aArray_Base[10][10] For $i = 0 To 9 For $j = 0 To 9 $aArray_Base[$i][$j] = $i Next Next _ArrayDisplay($aArray_Base, "2D - Original", Default, 8) $aArray = $aArray_Base _ArrayShuffle($aArray) _ArrayDisplay($aArray, "2D - Shuffled - All rows", Default, 8) $aArray = $aArray_Base _ArrayShuffle($aArray, 3, 8, 2) _ArrayDisplay($aArray, "2D - Shuffled - Col 2, 3-8", Default, 8) Link to comment Share on other sites More sharing options...
rizaado Posted July 3, 2015 Share Posted July 3, 2015 (edited) Local $aArr[2] $arr[0] = ... $arr[1] = ... Switch Random(0, 1, 1) Case 0 ... $arr[0] ... Case 1 ... $arr[1] ... EndSwitch Edited July 3, 2015 by rizaado Link to comment Share on other sites More sharing options...
aa2zz6 Posted July 3, 2015 Author Share Posted July 3, 2015 Thanks for the help guys. I was able to learn something new in the process. Link to comment Share on other sites More sharing options...
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