Jump to content

Movement Script


Recommended Posts

Hey, I'm brand new to AutoIt and am planning to start reading through some of the guides and tutorials, but before i do i was wondering this this would be possible. I want to create a script that will use the arrow keys to move while I'm away at first. If this is possible thing possibly expand on it but for now i just want it to be able to move around constantly(back and forth) until i stop it myself.

Link to comment
Share on other sites

Yep, that's possible.

Here's a few links good for reading..

http://www.autoitscript.com/autoit3/docs/

http://www.autoitscript.com/wiki/Tutorials

http://www.youtube.com/results?search_query=autoit&search_type=&aq=f

Welcome to a great forum!

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

; Press Esc to terminate script, Pause/Break to "Run"

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = Not $Paused
    If $Paused Then ToolTip('Script is "Running"', 0, 0)
    While $Paused
        Send("{LEFT 10}")
        Sleep(1000)
        Send("{RIGHT 10}")
        Sleep(1000)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox(4096, "", "Thanks Valuater ...8)     ")
EndFunc   ;==>ShowMessage

8)

NEWHeader1.png

Link to comment
Share on other sites

; Press Esc to terminate script, Pause/Break to "Run"
#include <ImageSearch.au3>
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d
$x1=0
$y1=0
;;;; Body of program would go here ;;;;
While 1
    Send("{UP}")
    Sleep(100)
    Send("{DOWN}")
    Sleep(100)
    $result = _ImageSearch("attack.bmp",1,$x1,$y1,100)
    if $result=1 Then
        MouseMove($x1,$y1,3)
        MouseClick("left",$x1,$y1,1,3)
        $result2 = _ImageSearch("wasp.bmp",1,$x1,$y1,100)
        if $result2=1 Then
            MouseMove($x1,$y1,3)
            MouseClick("left",$x1,$y1,1,3)
        elseIf $result2=0 Then
            $result3 = _ImageSearch("scorpion.bmp",1,$x1,$y1,100)
            if $result3=1 Then
                MouseMove($x1,$y1,3)
                MouseClick("left",$x1,$y1,1,3)
            EndIf
        EndIf
    EndIf
WEnd
;;;;;;;;
Func TogglePause()
    $Paused = Not $Paused
    If $Paused Then ToolTip('Script is "Running"', 0, 0)
    While $Paused
        Send("{LEFT 10}")
        Sleep(1000)
        Send("{RIGHT 10}")
        Sleep(1000)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox(4096, "", "Thanks Valuater ...8)     ")
EndFunc   ;==>ShowMessage

Okay i know this is probably horrible, but this is what i have so far. (and thanks again Valuater). But now i have a few problems i haven't been able to figure out.

1. I couldn't figure out how to make it send up and down constantly for a while before running the ImageSearch

2. And it seemed to take a while to find the images, is there any way to speed it up?

Edit: nvm i figured out a solution for my first problem

Edited by Becomplex114
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...