Sign in to follow this  
Followers 0
XTRobot

Why this doesn't work ?

3 posts in this topic

#1 ·  Posted (edited)

This code that i made doesnt have any syntax errors,but when i run it and when i press END for starting the bot,the bot doesnt start,and when i press END for closing it,the script doesn't exit. Can someon tell me why ? Where is the logycal error :)

HotKeySet("{HOME}","StartBOT")
HotKeySet("{END}","ExitBOT")

WinWaitActive("GAME")

$number = 1
$number1 = 2
Func ExitBOT ()
$number1 = 0
EndFunc
If $number1 = 0 Then
Exit
EndIf
Func StartBOT ()
$number1 = 1
EndFunc
If $number1 = 1 Then
Sleep(3000)
Send("^h")
Sleep(3000) 
Send("{F1}")                                                                                                                                                                                                                                      
Sleep(5000)                                                                                                                                     
Send("{F2}")
Sleep(5000)
Send("^h")                                          
Sleep(1000)
While $number < 2
Send("{F3 5}")
Send("{SPACE 100}")
Send("{` 10}")
Send("{F3 5}")
Send("{W down}")
Sleep(500)
Send("{W up}")
Send("{SPACE 100}")
Send("{` 10}")
Send("{F3 5}")
Send("{D down}")
Sleep(500)
Send("{F3 5}")
Send("{D up}")   
Send("{SPACE 100}")
Send("{` 10}")
Send("{F3 5}")
Send("{S down}")
Sleep(500)
Send("{S up}")
Send("{SPACE 100}")
Send("{` 10}")
Send("{F3 5}")
Send("{A down}")
Sleep(500)
Send("{A up}")
Send("{F3 5}")
Send("{` 10}")
WEnd
EndIf
Edited by XTRobot

Share this post


Link to post
Share on other sites



See the example of "HotKeySet" at the bottom of the help file page

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

becose in most of the cases you need to have func behinde main loop

HotKeySet("{HOME}","_start")
HotKeySet("{END}","_exit")
Global $number = 1
;~ WinWaitActive("winname")

While 1
    Sleep(10)
    If $number = 2 Then
        ;<== your code heare
        ToolTip("222")
    ElseIf $number = 3 Then
        Exit
    EndIf
WEnd

Func _exit()
    $number = 3
EndFunc

Func _start()
    $number = 2
EndFunc

if you tested from help file on HotKeySet example you probably realized that your self

your script exits as soon as your game win is activated becose you dont have main loop before them

Func ExitBOT ()
    $number1 = 0
EndFunc
If $number1 = 0 Then
    Exit
EndIf

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

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  
Followers 0