Guest hewge Posted July 22, 2005 Posted July 22, 2005 Anyone know how i can make this script to not eat so much cpu ? any ideas ? and if someone wanna know its for tibia. (sorry for my bad english)pkat2.au3
Nova Posted July 22, 2005 Posted July 22, 2005 (edited) This should work, you only need one while wend loop to do what you want. Having two loops in the format you were origionally using is a definate cpu gobbler. I just edited this in notepad, becasue im in work, so I havnt tested it. expandcollapse popupDim $xuh = 1130, $yuh = 400 Dim $xplayer = 550, $yplayer = 435 Dim $Activation Dim $Activation1 Dim $Activation2 Dim $aim Dim $hitpointcoord Dim $color_hitpoint Dim $rune HotkeySet ("{NUMPAD1}", "activate") HotkeySet ("{NUMPAD2}", "activate1") HotkeySet ("{NUMPAD3}", "activate2") HotkeySet ("{NUMPAD5}", "use_uh") HotkeySet ("{NUMPAD6}", "setminhp") HotkeySet ("{NUMPAD4}", "Setrune") HotkeySet ("{NUMPAD0}", "shoot") HotkeySet ("{PGDN}", "use_uh") HotkeySet ("{END}", "shoot") HotkeySet ("{F5}", "Terminate") MsgBox ( 32, "Configuration", "Move cursor to where the hitpoint indicator should be") Sleep (5000) $hitpointcoord = MouseGetPos () $color_hitpoint = PixelGetColor ($hitpointcoord[0], $hitpointcoord[1]) MsgBox ( 32, "Configuration", "Done") Func setminhp () $hitpointcoord = MouseGetPos () $color_hitpoint = PixelGetColor ($hitpointcoord[0], $hitpointcoord[1]) EndFunc While 1 If $Activation = 0 Then Sleep (1000) else If $Activation1 < 3 And PixelGetColor ($hitpointcoord[0], hitpointcoord[1]) <> $color_hitpoint Then BlockInput (1) $aim = MouseGetPos () MouseClick ("Right", $xuh, $yuh, 1, 0) Sleep (10) MouseClick ("Left", $xplayer, $yplayer, 1 ,0) Sleep (10) MouseMove ($aim[0], $aim[1], 0) BlockInput (0) Else EndIf Endif Wend Func use_uh () BlockInput (1) $aim = MouseGetPos () MouseClick ("Right", $xuh, $yuh, 1, 0) Sleep (10) MouseClick ("Left", $xplayer, $yplayer, 1 ,0) Sleep (10) MouseMove ($aim[0], $aim[1], 0) BlockInput (0) EndFunc Func Terminate() Exit 0 EndFunc Func Setrune () $rune = MouseGetPos() EndFunc Func activate () $Activation = $Activation + 1 If $Activation > 1 Then $Activation = 0 $Activation1 = 0 $Activation2 = 0 Else EndIf EndFunc Func shoot () BlockInput (1) $aim = MouseGetPos () Sleep (10) MouseMove ($rune[0], $rune[1], 0) MouseDown ("right") MouseUp ("right") Sleep (10) MouseMove ($aim[0], $aim[1], 0) Sleep (10) MouseDown ("left") MouseUp ("Left") BlockInput (0) EndFunc Func activate1 () $Activation1 = $Activation1 + 1 If $Activation1 > 3 Then $Activation1 = 0 EndFunc Func activate2 () $Activation2 = $Activation2 + 1 If $Activation2 > 3 Then $Activation2 = 0 EndFunc Edited July 22, 2005 by Nova
Guest hewge Posted July 22, 2005 Posted July 22, 2005 (edited) Thanks , testing it now If statements Must have a Then keyword :/ Edited July 22, 2005 by hewge
dumdum8684 Posted July 22, 2005 Posted July 22, 2005 This should work, you only need one while wend loop to do what you want.Having two loops in the format you were origionally using is a definate cpu gobbler.I just edited this in notepad, becasue im in work, so I havnt tested it.While $Activation = 0 Sleep (1000) While 1 If $Activation = 0 Then Sleep (1000) else If $Activation1 < 3 And PixelGetColor ($hitpointcoord[0], hitpointcoord[1]) <> $color_hitpoint Then BlockInput (1) $aim = MouseGetPos () MouseClick ("Right", $xuh, $yuh, 1, 0) Sleep (10) MouseClick ("Left", $xplayer, $yplayer, 1 ,0) Sleep (10) MouseMove ($aim[0], $aim[1], 0) BlockInput (0) Else EndIf Endif Wend<{POST_SNAPBACK}>Shouldn't you get rid of the While $Activation = 0 and the sleep after it. Just tryin to help.-Aaron
Nova Posted July 22, 2005 Posted July 22, 2005 Of course, this is what happens when you try help somebody using notepad as your script editor and not being able to run the script your trying to fix while on a computer at work.
dumdum8684 Posted July 22, 2005 Posted July 22, 2005 (edited) EDIT: Nova, your "My AutoIt Stuff" link doesn't work...just thought i would let you know. Edited July 22, 2005 by dumdum8684
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