AvE Posted July 22, 2009 Posted July 22, 2009 Hello everyone. I've just started to write simple bots in AutoIt. I've made a simple program which lets you do bunny-hop in Counter-Strike. My problem is, when someone use the program, CPU Usage is about 50%. How can I fix it? There's the code of my program. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> WinSetTitle("Counter-Strike","","Counter-Strike [CS Auto-BunnyHop by AvE]") $NumerOfJumpes = IniRead("CS_Auto-BunnyHop.ini","Settings","$NumberOfJumpes",15) $Delay = IniRead("CS_Auto-BunnyHop.ini","Settings","$Delay",100) $Form1 = GUICreate("CS Auto-BunnyHop v0.1", 238, 345, -1, -1) $Pic1 = GUICtrlCreatePic("bunny11.jpg", 0, 0, 236, 188, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Label1 = GUICtrlCreateLabel("CS Auto-BunnyHop", 64, 200, 112, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Version: 0.1", 88, 216, 60, 17) $Label3 = GUICtrlCreateLabel("VAC Proof:", 64, 248, 66, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Group1 = GUICtrlCreateGroup("", 0, 184, 233, 57) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label4 = GUICtrlCreateLabel("4EVER", 128, 248, 44, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) $Label5 = GUICtrlCreateLabel("Programmed by AvE.", 64, 272, 103, 17) $Label6 = GUICtrlCreateLabel("My Steam:", 64, 296, 54, 17) $Label7 = GUICtrlCreateLabel("pro885", 120, 296, 43, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label8 = GUICtrlCreateLabel("HAPPY BUNNYHOPPING!", 40, 320, 152, 17) GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif") IniWrite("CS_Auto-BunnyHop.ini","Settings","$NumberOfJumpes",$NumerOfJumpes) IniWrite("CS_Auto-BunnyHop.ini","Settings","$Delay",$Delay) GUISetState(@SW_SHOW) While 1 If _IsPressed(4) Then Jump() EndIf WEnd Func _IsPressed($hexKey) $hexKey = DllCall("user32", "int", "GetAsyncKeyState", "int", '0x' & $hexKey) If Not @error And BitAND($hexKey[0], 0x8000) = 0x8000 Then Return True Return False EndFunc Func Jump() Send("{SPACE $NumerOfJumpes}") Sleep($Delay) EndFunc
Developers Jos Posted July 22, 2009 Developers Posted July 22, 2009 Add a Sleep(10) in your while loop. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
water Posted July 22, 2009 Posted July 22, 2009 You have a very tight loop that needs a Sleep to reduce CPU usage:While 1 If _IsPressed(4) Then Jump() EndIf Sleep(100) WEnd My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now