Jump to content

Confusing Code


Recommended Posts

Yours works, except i want it to stop @ each down, then do the next down. After all downs down it moves across a right then does the downs again, etc.

Tee hee this is fun

$Downs = 5
$Rights = 2
$Pos = MouseGetPos()
$Collumns = 0


While $Collumns <= $Rights/2
For $i=0 to $Downs
    MouseMove( $Pos[0], $Pos[1]+$i*10 )
Next
$Pos = MouseGetPos()
    MouseMove( $Pos[0]+15, $Pos[1] )
    $Pos = MouseGetPos()
    For $i=0 to $Downs
    MouseMove( $Pos[0], $Pos[1]-$i*10 )
Next
$Pos = MouseGetPos()
MouseMove( $Pos[0]+15, $Pos[1] )
$Rights -= 1
$Pos = MouseGetPos()
Wend
Edited by Qousio
Link to comment
Share on other sites

Tee hee this is fun

$Downs = 5
$Rights = 2
$Pos = MouseGetPos()
$Collumns = 0


While $Collumns <= $Rights/2
For $i=0 to $Downs
    MouseMove( $Pos[0], $Pos[1]+$i*10 )
Next
$Pos = MouseGetPos()
    MouseMove( $Pos[0]+15, $Pos[1] )
    $Pos = MouseGetPos()
    For $i=0 to $Downs
    MouseMove( $Pos[0], $Pos[1]-$i*10 )
Next
$Pos = MouseGetPos()
MouseMove( $Pos[0]+15, $Pos[1] )
$Rights -= 1
$Pos = MouseGetPos()
Wend

Thanks You!

Edit: Doesn't stop at each down :)

Edited by Godly
Link to comment
Share on other sites

Thanks You!

Edit: Doesn't stop at each down :)

I'm guessing it just works very fast. Try adding sleep(100) between the loops.

Because it works perfectly for me =P

$Downs = 5
$Rights = 2
$Pos = MouseGetPos()
$Collumns = 0


While $Collumns <= $Rights/2
For $i=0 to $Downs
    MouseMove( $Pos[0], $Pos[1]+$i*10 )
    Sleep(100)
Next
$Pos = MouseGetPos()
    MouseMove( $Pos[0]+15, $Pos[1] )
    $Pos = MouseGetPos()
    For $i=0 to $Downs
    MouseMove( $Pos[0], $Pos[1]-$i*10 )
    Sleep(100)
Next
$Pos = MouseGetPos()
MouseMove( $Pos[0]+15, $Pos[1] )
$Rights -= 1
$Pos = MouseGetPos()
Wend
Edited by Qousio
Link to comment
Share on other sites

I'm guessing it just works very fast. Try adding sleep(100) between the loops.

Because it works perfectly for me =P

Here is my current bot, I just want the user able to define how many columns & how many boxes per column.

Global $Mine = False
Opt("MouseCoordMode", 2)

;$Hight = InputBox("Height", "How many squares high?")
;$Width = InputBox("Width", "How many squares long?")
Setup()
All()

Func Setup()
    Run("winmine.exe")
    WinWaitActive("Minesweeper")
    Sleep(100)

    Send("xyzzy")
    Send("{SHIFTDOWN}{ENTER}{SHIFTUP}")
    Sleep(100)
EndFunc   ;==>Setup

Func DoRow()
    $i = 0
    Do
        $Pos = MouseGetPos()
        MouseMove($Pos[0], $Pos[1] + 16, 1)
        $var = PixelGetColor(0, 0)
        If $var = 0 Then
            Sleep(10)
        Else
            MouseClick("Left")
        EndIf
        $i = $i + 1
    Until $i = 9
EndFunc   ;==>DoRow

Func All()
    MouseMove(20, 45, 0)
    DoRow()
    MouseMove(35, 45, 1)
    DoRow()
    MouseMove(50, 45, 1)
    DoRow()
    MouseMove(70, 45, 1)
    DoRow()
    MouseMove(85, 45, 1)
    DoRow()
    MouseMove(100, 45, 1)
    DoRow()
    MouseMove(115, 45, 1)
    DoRow()
    MouseMove(130, 45, 0)
    DoRow()
    MouseMove(147, 45, 0)
    DoRow()
EndFunc   ;==>All
Link to comment
Share on other sites

Here is my current bot, I just want the user able to define how many columns & how many boxes per column.

Global $Mine = False
Opt("MouseCoordMode", 2)

;$Hight = InputBox("Height", "How many squares high?")
;$Width = InputBox("Width", "How many squares long?")
Setup()
All()

Func Setup()
    Run("winmine.exe")
    WinWaitActive("Minesweeper")
    Sleep(100)

    Send("xyzzy")
    Send("{SHIFTDOWN}{ENTER}{SHIFTUP}")
    Sleep(100)
EndFunc   ;==>Setup

Func DoRow()
    $i = 0
    Do
        $Pos = MouseGetPos()
        MouseMove($Pos[0], $Pos[1] + 16, 1)
        $var = PixelGetColor(0, 0)
        If $var = 0 Then
            Sleep(10)
        Else
            MouseClick("Left")
        EndIf
        $i = $i + 1
    Until $i = 9
EndFunc   ;==>DoRow

Func All()
    MouseMove(20, 45, 0)
    DoRow()
    MouseMove(35, 45, 1)
    DoRow()
    MouseMove(50, 45, 1)
    DoRow()
    MouseMove(70, 45, 1)
    DoRow()
    MouseMove(85, 45, 1)
    DoRow()
    MouseMove(100, 45, 1)
    DoRow()
    MouseMove(115, 45, 1)
    DoRow()
    MouseMove(130, 45, 0)
    DoRow()
    MouseMove(147, 45, 0)
    DoRow()
EndFunc   ;==>All
o_O ?

$Collumn = InputBox( "", "" )
$Boxes = InputBox( "", "" )
;Testing if it works
MsgBox( 0, "", $Collumn )
MsgBox( 0, "", $Boxes )
Link to comment
Share on other sites

o_O ?

$Collumn = InputBox( "", "" )
$Boxes = InputBox( "", "" )
;Testing if it works
MsgBox( 0, "", $Collumn )
MsgBox( 0, "", $Boxes )
I know what an input box is, just need the code to move the mouse down however many boxes then across a column then down however many then across etc.
Link to comment
Share on other sites

I know what an input box is, just need the code to move the mouse down however many boxes then across a column then down however many then across etc.

The code that I have posted above does exactly what you want... Just change

$Downs

$Rights

as needed. Perhaps, I don't understand what exactly you are trying to do...

This is what the above code does: Posted Image

Link to comment
Share on other sites

The code that I have posted above does exactly what you want... Just change

$Downs

$Rights

as needed. Perhaps, I don't understand what exactly you are trying to do...

This is what the above code does: Posted Image

I know thats good, but i put like 4 rights it does like 7 rights lol.
Link to comment
Share on other sites

I know thats good, but i put like 4 rights it does like 7 rights lol.

This works for any amount of even $Rights. Such as 2,4,6,8,10,12,14,16...etc

$Downs = 5
$Rights = 2
$Pos = MouseGetPos()
$Collumns = 0

MoveMe($Rights/2)
Func MoveMe($I_am_hungry)
    Do
For $i=0 to $Downs
    
    MouseMove( $Pos[0], $Pos[1]+$i*10 )
    Sleep(100)
Next
$Pos = MouseGetPos()
    MouseMove( $Pos[0]+15, $Pos[1] )
    $Pos = MouseGetPos()
    For $i=0 to $Downs
    MouseMove( $Pos[0], $Pos[1]-$i*10 )
    Sleep(100)
Next
$Pos = MouseGetPos()
MouseMove( $Pos[0]+15, $Pos[1] )
$Rights -= 1
$Pos = MouseGetPos()

$I_am_hungry -= 1
Until $I_am_hungry = 0
EndFunc

:)

Link to comment
Share on other sites

$max_x = 5
$max_y = 5

$original_pos = MouseGetPos()

For $x = 1 to $max_x
    $J = MouseGetPos ()
    MouseMove ($J[0] + 17, 45)
    For $y = 1 to $max_y
        $b = MouseGetPos ()
        MouseMove ($b[0], $b[1] + 10)
        Sleep (100)
    Next
Next

Cheers,

Brett

Link to comment
Share on other sites

$max_x = 5
$max_y = 5

$original_pos = MouseGetPos()

For $x = 1 to $max_x
    $J = MouseGetPos ()
    MouseMove ($J[0] + 17, 45)
    For $y = 1 to $max_y
        $b = MouseGetPos ()
        MouseMove ($b[0], $b[1] + 10)
        Sleep (100)
    Next
Next

Cheers,

Brett

Thank You!
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...