Jump to content
Sign in to follow this  
CyNDeR

There has to be a better way to do this.

Recommended Posts

CyNDeR

This is a Function from a script i'm writing:

Func PickColor()
    $color = Random(1, 28, 1)
    If $color = 1 Then
        MouseClick("left", 38, 646, 1, 0)
    ElseIf $color = 2 Then
        MouseClick("left", 53, 646, 1, 0)
    ElseIf $color = 3 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 4 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 5 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 6 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 7 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 8 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 9 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 10 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 11 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 12 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 13 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 14 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 15 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 16 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 17 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 18 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 19 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 20 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 21 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 22 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 23 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 24 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 25 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 26 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 27 Then
        MouseClick("left", 70, 646, 1, 0)
    ElseIf $color = 28 Then
        MouseClick("left", 70, 646, 1, 0)
    EndIf
EndFunc   ;==>PickColor

As you can see, it has alot of ElseIf statements. The mouse cordinates arent all filled in yet, but you get the idea. Is there a better way to do this?


My scripts: Random Painter

Share this post


Link to post
Share on other sites
PsaltyDS

Even better would be to carefully consider the mathematical relationship between those coordinates. How many different coordinates are there. Are they evenly spaced, and by how much? Etc.

Then just do the math to generate coordinates. Best method depends on the particular circumstances.

<_<


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  

×