Jump to content
aa2zz6

How would I set a random array for two MouseClickDrag

Recommended Posts

aa2zz6

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

Share this post


Link to post
Share on other sites
rizaado

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

Share this post


Link to post
Share on other sites
Venix
Switch Random(0, 1, 1)
    Case 0
         ;Some Code
    Case 1
        ;Some Code
EndSwitch

If you just want to select randomly between multiple options would something like this not work?

Edited by Venix
Code Error

Share this post


Link to post
Share on other sites
rizaado
#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)

 

Share this post


Link to post
Share on other sites
rizaado
Local $aArr[2]
$arr[0] = ...
$arr[1] = ...
Switch Random(0, 1, 1)
    Case 0
         ... $arr[0] ...
    Case 1
         ... $arr[1] ...
EndSwitch

 

Edited by rizaado

Share this post


Link to post
Share on other sites
aa2zz6

Thanks for the help guys. I was able to learn something new in the process.

Share this post


Link to post
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

×