Jump to content

How would I set a random array for two MouseClickDrag


Recommended Posts

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 Then

somehow use an array to pick either

MouseClickDrag("left", 594, 113, 631, 656  <<== Up to Down

MouseClickDrag("left", 1162, 306, 200, 315) <<=== Left to Right

Link to comment
Share on other sites

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 by rizaado
Link to comment
Share on other sites

#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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...