Jump to content

lag


acez
 Share

Recommended Posts

#Include <Misc.au3>

HotKeySet("!{ESC}", "Terminate")

$Color = "0xEB00A7"; pink this is just for testing....it will only target cts with the mdls i made

$Colo1 = "0xB1007E";

$Colo2 = "0xAD007B"

$Colo3 = "0x65004A"

$left = 460

$top = 380

$right = 540

$bottem = 430

$dll = DllOpen("user32.dll")

While 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hotkeys________________________

_________________

if _IsPressed("39",$dll) Then ; 9

$Color = "0xD60000";

SoundPlay(@MyDocumentsDir & "\t.wav",0)

sleep(500)

Else

if _IsPressed("30",$dll) Then; 0

$Color = "0xD60000"

SoundPlay(@MyDocumentsDir & "\ct.wav",0)

sleep(500)

Else

If _IsPressed("26",$dll) Then;up

$left = 460

$top = 380

$right = 540

$bottem = 430

Else

If _IsPressed("28",$dll) Then;down

$left = 490

$top = 380

$right = 510

$bottem = 430

Else

if WinActive("Counter-Strike") Then

If _IsPressed("01", $dll) Then

$Pos = PixelSearch($left,$top,$right,$bottem, $Color, 10,2)

If IsArray($Pos) Then

MouseMove($Pos[0],$Pos[1],0)

Else

$Pos = PixelSearch($left,$top,$right,$bottem, $Colo1, 10,2)

if IsArray($Pos) Then

MouseMove($Pos[0],$Pos[1],0)

Else

$Pos = PixelSearch($left,$top,$right,$bottem, $Colo2, 10,2)

if IsArray($Pos) Then

MouseMove($Pos[0],$Pos[1],0)

Else

$Pos = PixelSearch($left,$top,$right,$bottem, $Colo3, 10,2)

if IsArray($Pos) Then

MouseMove($Pos[0],$Pos[1],0)

Else

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

WEnd

Func Terminate()

Exit 0

EndFunc

DllClose($dll)

Link to comment
Share on other sites

Hmm, I experienced something similar when creating a bot for Diablo 2. The lag remains constant as the While-WEnd loop is looping (that's what i believe anyway). Not sure how to fix it, perhaps slowing down the loop (add sleep(x)) so it does not lag as much since it wouldn't need to do as much work.

Hopefully that helped,

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

I cleaned it up a bit. You will need to test to see if the CPU hunger problem is fixed. I suspect it isn't. The winactive may be the cause. You may need to setup a sub loop to fix it.

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

$Color = "0xEB00A7"; pink this is just for testing....it will only target cts with the mdls i made
$Colo1 = "0xB1007E";
$Colo2 = "0xAD007B"
$Colo3 = "0x65004A"


$left = 460
$top = 380
$right = 540
$bottem = 430
$dll = DllOpen("user32.dll")

While 1
    Select
        case _IsPressed("39",$dll)
            $Color = "0xD60000";
            SoundPlay(@MyDocumentsDir & "\t.wav",0)
            sleep(500)
        case _IsPressed("30",$dll)
            $Color = "0xD60000"
            SoundPlay(@MyDocumentsDir & "\ct.wav",0)
            sleep(500)
        case _IsPressed("26",$dll)
            $left = 460
            $top = 380
            $right = 540
            $bottem = 430
        case  _IsPressed("28",$dll) 
            $left = 490
            $top = 380
            $right = 510
            $bottem = 430
    EndSelect

    if WinActive("Counter-Strike") Then
        If _IsPressed("01", $dll) Then
            $Pos = PixelSearch($left,$top,$right,$bottem, $Color, 10,2)
        EndIf
    endif   
    If IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo1, 10,2)
    endif   
    if IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo2, 10,2)
    endif   
    if IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo3, 10,2)
    endif   
    if IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
    EndIf
WEnd

Func Terminate()


Exit 0
EndFunc
DllClose($dll)
Edited by Volly
Link to comment
Share on other sites

I cleaned it up a bit

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

$Color = "0xEB00A7"; pink this is just for testing....it will only target cts with the mdls i made
$Colo1 = "0xB1007E";
$Colo2 = "0xAD007B"
$Colo3 = "0x65004A"
$left = 460
$top = 380
$right = 540
$bottem = 430
$dll = DllOpen("user32.dll")

While 1
    Select
        case _IsPressed("39",$dll)
            $Color = "0xD60000";
            SoundPlay(@MyDocumentsDir & "\t.wav",0)
            sleep(500)
        case _IsPressed("30",$dll)
            $Color = "0xD60000"
            SoundPlay(@MyDocumentsDir & "\ct.wav",0)
            sleep(500)
        case _IsPressed("26",$dll)
            $left = 460
            $top = 380
            $right = 540
            $bottem = 430
        case  _IsPressed("28",$dll) 
            $left = 490
            $top = 380
            $right = 510
            $bottem = 430
    EndSelect

    if WinActive("Counter-Strike") Then
        If _IsPressed("01", $dll) Then
            $Pos = PixelSearch($left,$top,$right,$bottem, $Color, 10,2)
        EndIf
    endif   
    If IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo1, 10,2)
    endif   
    if IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo2, 10,2)
    endif   
    if IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo3, 10,2)
    endif   
    if IsArray($Pos) Then
        MouseMove($Pos[0],$Pos[1],0)
    Else
    EndIf
WEnd

Func Terminate()
Exit 0
EndFunc
DllClose($dll)
This script gives me this error:

If IsArray($Pos) Then

If IsArray(^ ERROR

Link to comment
Share on other sites

i gave him this code...i was going to poist a question but never had time...

this program runs perfict on my labtop but when i run it on my desktop my fps drops to like 10

Lagg like crazzy

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

$Color = "0xEB00A7"; pink this is just for testing....it will only target cts with the mdls i made
$Colo1 = "0xB1007E";
$Colo2 = "0xAD007B"
$Colo3 = "0x65004A"
$Colo4 = "0x7B0056"
$Colo5 = "0xE300A2"
$colo6 = "0x3C0029"
$colo7 = "0x36002F"
$Colo8 = "0xC300BB"
$colo9 = "0x53006C"
$key = "01"
$left = 460
$top = 375
$right = 540
$bottem = 430
$dll = DllOpen("user32.dll")
While 1
    if _IsPressed("39",$dll) Then ; 9
        $Color = "0xEB00A7"; pink this is just for testing....it will only target cts with the mdls i made
        $Colo1 = "0xB1007E";
        $Colo2 = "0xAD007B"
        $Colo3 = "0x65004A"
        $Colo4 = "0x7B0056"
        $Colo5 = "0xE300A2"
        $colo6 = "0x1B001B"
        $colo7 = "0x36002F"
        $Colo8 = "0xC300BB"
        $colo9 = "0x53006C"
        SoundPlay(@MyDocumentsDir & "\t.wav",0)
        sleep(500)
    Else
        if _IsPressed("30",$dll) Then; 0
            $Color = "0x00CC87";teal this is just for testing....it will only target cts with the mdls i made
            $Colo1 = "0x007D53";
            $Colo2 = "0x001F22"
            $Colo3 = "0x001B1C"
            $Colo4 = "0x00B377"
            $Colo5 = "0x009F69"
            $colo6 = "0x00A6A6"
            $colo7 = "0x006D67"
            $Colo8 = "0x00A6A6"
            $colo9 = "0x009F69"
            SoundPlay(@MyDocumentsDir & "\ct.wav",0)
            sleep(500)
        Else
            If _IsPressed("26",$dll) Then;up
                $left = 460
                $top = 375
                $right = 540
                $bottem = 430
                $key = "01"
            Else
                If _IsPressed("28",$dll) Then;down
                    $left = 490
                    $top = 370
                    $right = 510
                    $bottem = 430
                    $key = "10"
                Else
                    
                    if WinActive("Counter-Strike") Then
                        If _IsPressed($key, $dll) Then

                            $Pos = PixelSearch($left,$top,$right,$bottem, $Color, 10,2)
                            If IsArray($Pos) Then
                                MouseMove($Pos[0],$Pos[1],0)
                                
                                
                            Else
                                $Pos = PixelSearch($left,$top,$right,$bottem, $Colo1, 10,2)
                                if IsArray($Pos) Then
                                    MouseMove($Pos[0],$Pos[1],0)
                                    

                                Else
                                    $Pos = PixelSearch($left,$top,$right,$bottem, $Colo2, 10,2)
                                    if IsArray($Pos) Then
                                        MouseMove($Pos[0],$Pos[1],0)
                                        

                                    Else
                                        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo3, 10,2)
                                        if IsArray($Pos) Then
                                            MouseMove($Pos[0],$Pos[1],0)
                                            

                                        Else
                                            $Pos = PixelSearch($left,$top,$right,$bottem, $Colo4, 10,2)
                                            if IsArray($Pos) Then
                                                MouseMove($Pos[0],$Pos[1],0)
                                                

                                            Else
                                                $Pos = PixelSearch($left,$top,$right,$bottem, $Colo5, 10,2)
                                                if IsArray($Pos) Then
                                                    MouseMove($Pos[0],$Pos[1],0)
                                                    

                                                Else
                                                    $Pos = PixelSearch($left,$top,$right,$bottem, $Colo6, 10,2)
                                                    if IsArray($Pos) Then
                                                        MouseMove($Pos[0],$Pos[1],0)
                                                        

                                                    Else
                                                        $Pos = PixelSearch($left,$top,$right,$bottem, $Colo7, 10,2)
                                                        if IsArray($Pos) Then
                                                            MouseMove($Pos[0],$Pos[1],0)
                                                            
                                                        Else
                                                            $Pos = PixelSearch($left,$top,$right,$bottem, $Colo8, 10,2)
                                                            if IsArray($Pos) Then
                                                                MouseMove($Pos[0],$Pos[1],0)
                                                                
                                                            Else
                                                                $Pos = PixelSearch($left,$top,$right,$bottem, $Colo9, 10,2)
                                                                if IsArray($Pos) Then
                                                                    MouseMove($Pos[0],$Pos[1],0)
                                                                    


                                                                EndIf
                                                            EndIf
                                                        EndIf
                                                    EndIf
                                                EndIf
                                            EndIf
                                        EndIf
                                    EndIf
                                EndIf
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf



WEnd

Func Terminate()
    DllClose($dll)
    ;ProcessSetPriority("autoit3.exe",2)
    ;ProcessSetPriority("steam.exe",2)
    ;ProcessSetPriority("hl.exe",2)
    

    Exit 0
EndFunc
Link to comment
Share on other sites

I really have no idea. Perhaps adding a small sleep inside the While-WEnd loop. So, at the END of your While loop (before Wend) add: Sleep(100) so it sleeps 100 milliseconds so maybe the computer won't need to work so hard.

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

i found that the first time i run the program, it runs perfict...

thin after i press alt-esc (terminate) thin when i run the program agn my fps is at 20...

could this be DllClose($dll) not taking effect or something...?

i tryd adding sleep all threw the script.. doesnt help

i lowerd the FOV (feald of view) it help a little...

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...