Jump to content
Sign in to follow this  
Becomplex114

Movement Script

Recommended Posts

Becomplex114

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.

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
Share on other sites
ShawnW

Answer:

Yes, very easy.

Advice:

whatever game you are wanting to do this in I recommend you read the announcements and make sure it is one that you are allowed to discuss here.

Share this post


Link to post
Share on other sites
Valuater

; 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

Share this post


Link to post
Share on other sites
Becomplex114

Thanks for the quick replies everyone, looking forward to learning more about AutoIt scripting.

Share this post


Link to post
Share on other sites
Becomplex114

; 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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.