Sign in to follow this  
Followers 0
onedayillpay

Loop_ If then Elseif

4 posts in this topic

i have had this problem befor and dont remember the solution...

only the last 3 if statments work...

i know its a simmple fix... i just dont remember...

#Include <Misc.au3>
HotKeySet("!{ESC}", "Terminate")
HotKeySet("{END}", "test")

$left = 640
$top = 514
$right = 640
$bottem = 512
$fov = 0
$dll = DllOpen("user32.dll")
$terrorB = "0xFF00F7"
$terrorD = "0x63005A"
$CtB = "0x00FBEF"
$CtD = "0x00827B"
$key = "01"
While 1

    If _IsPressed("39", $dll) Then ; 9
        $ColorB = $terrorB; "0xFF00F7" ; bright pink
        $ColorD = $terrorD; "0x63005A" ; dark pink
        Sleep(500)
    ElseIf _IsPressed("30", $dll) Then; 0
        $ColorB = $CtB; "0x00FBEF"  ; bright teal
        $ColorD = $CtD; "0x00827B"  ; dark teal
        Sleep(500)
    ElseIf _IsPressed("2D", $dll) Then; Insert
        ToolTip("assalt - Rifles, Mouse 1", 450, 0)
        ToolTip("assalt - Rifles, Mouse 1", 450, 0)
        $terrorB = "0xFF00F7";
        $terrorD = "0x63005A";
        $CtB = "0x00FBEF";
        $CtD = "0x00827B";
        $key = "01"
        Sleep(500)
    ElseIf _IsPressed("2E", $dll) Then; Delete
        ToolTip("Awp - Power, Shift Key", 450, 0)
        ToolTip("Awp - Power, Shift Key", 450, 0)
        $terrorB = "0xCE0000"
        $terrorD = "0x7B0000"
        $CtB = "0x0000CE"
        $CtD = "0x00006B"
        $key = "10"
        Sleep(500)

    ElseIf _IsPressed("26", $dll) Then
        $left = $left - 1
        $top = $top - 1
        $right = $right + 1
        $bottem = $bottem + 1
        $fov = $fov + 1
        ToolTip("fov turned up" & "'" & $fov & "'", 450, 0)
        ToolTip("fov turned up" & "'" & $fov & "'", 450, 0)
        Sleep(100)
    ElseIf _IsPressed("28", $dll) Then
        $left = $left + 1
        $top = $top + 1
        $right = $right - 1
        $bottem = $bottem - 1
        $fov = $fov - 1
        ToolTip("fov turned Down" & "'" & $fov & "'", 450, 0)
        ToolTip("fov turned Down" & "'" & $fov & "'", 450, 0)
        Sleep(100)
    ElseIf _IsPressed($key, $dll) Then
        MsgBox(0, "popo", "o")
        ;$key = "01"
        If WinActive("Counter-Strike") Then
            $Pos = PixelSearch($left, $top, $right, $bottem, $ColorB, 100, 1)
            If IsArray($Pos) Then
                MouseMove($Pos[0], $Pos[1], 0)
                Send("{ENTER}")
                Send("{PGDN}")
                Sleep(20)
            Else
                $Pos = PixelSearch($left, $top, $right, $bottem, $ColorD, 25, 1)
                If IsArray($Pos) Then
                    MouseMove($Pos[0], $Pos[1], 0)
                    Send("{ENTER}")
                    Send("{PGDN}")
                    Sleep(20)
                    
                EndIf
            EndIf
        EndIf
    EndIf
    



    Sleep(100)


WEnd

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate
DllClose($dll)

Func test()
    MouseMove($left, $top, 5)
    
    
    MouseMove($left, $bottem, 5)
    Sleep(100)
    MouseMove($right, $top, 5)
    Sleep(100)
    MouseMove($right, $bottem, 5)
    Sleep(100)
EndFunc   ;==>test

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

maybe use a switch or select statement instead.

Edited by sccrstvn93

Share this post


Link to post
Share on other sites

get rid of that 100 millisecond sleep... make it 10. Your average key down press is around 20-40, so having a long sleep will sometimes make key not register.


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

lol... it works just fine....

yes i will take out some of the sleep(500) witch did make it seem like some keys were not operating on time...

thanks....

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