kanakukk Posted August 17, 2009 Share Posted August 17, 2009 (edited) This script is for java applet. Idk if it clicks too fast or something but after working about 30-40 minutes it will crash the java applet. What should I do? Any tips how to make it more smooth? expandcollapse popupGlobal $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{Home}", "Aste") ;~ AutoItSetOption("SendKeyDelay", 320) ;~ Alters the the length of the brief pause in between sent keystrokes. ;~ AutoItSetOption("SendKeyDownDelay", 320) ;~ Alters the length of time a key is held down before being released during a keystroke. ;~ KEERA KAARTI 90 KRAADI AutoItSetOption ("MouseClickDelay", 100); Sleep(Random(3002,4039)) WinActivate ( "Window X") ;~ Siit asi algab $ammount = 0; $step = 1; MouseMove(387,274); Sleep(Random(1384,1478)) While 1 If $step = 1 Then $blue_hat = PixelSearch(424, 111, 500, 700, 0x0000F8, 2); If Not @error Then $red = PixelSearch(387, 274, 500, 700, 0xFF0000, 2); If Not @error Then $coord_1 = $red[0]+Random(-2,1) $coord_2 = $red[1]+Random(-2,1) MouseClick ( "left", $coord_1, $coord_2, 1) Sleep(Random(10,14)); Else $step = 2; EndIf Else ; $step = 5; EndIf EndIf If $step = 2 Then ;~ 185,113 Mouseclick( "left", 185, 113, 1); Sleep(Random(1384,1478)) MouseMove(394,277); Sleep(Random(1384,1478)) $step = 3 EndIf if $step = 3 Then $red_2 = PixelSearch(394, 277, 500, 700, 0xFF0000, 2); if not @error Then $coord_x1 = $red_2[0]+Random(-2,1) $coord_x2 = $red_2[1]+Random(-2,1) MouseClick ( "left", $coord_x1, $coord_x2, 1) Sleep(Random(10,14)); Else $step = 4 EndIf Endif If $step = 4 Then ;closing window MouseClick( "left", 89, 115) Sleep(Random(314,478)) MouseMove(387,274); Sleep(Random(1384,1478)) $ammount = $ammount + 1 if $ammount >= 12 Then $step = 5; Else $step = 1; EndIf EndIf If $step = 5 Then ;searching the witch MouseClick("left", 414+Random(-1,1), 75+Random(-3,3)) Sleep(Random(1384,1478)) $witch = PixelSearch(182, 96, 500, 700, 0x910000, 1); If not @error Then MouseClick ( "left", $witch[0], $witch[1], 1) Sleep(Random(3384,3778)) MouseClick("left", 61+Random(-1,1), 31+Random(-1,1)) Sleep(Random(3384,3778)) $ammount = 0; $step = 1; Else $witch = PixelSearch(182, 96, 500, 700, 0xD00000, 1); If Not @error Then MouseClick ( "left", $witch[0], $witch[1], 1) Sleep(Random(3384,3778)) MouseClick("left", 61+Random(-1,1), 31+Random(-1,1)) Sleep(Random(2384,2778)) $ammount = 0; $step = 1; Else Sleep(Random(1100,1500)) $step = 5; EndIf EndIf EndIf WEnd Func Step() MsgBox(0, "Step", $step); EndFunc ;~ Siit asi lõpeb Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script has been stopped"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Edited August 17, 2009 by kanakukk Link to comment Share on other sites More sharing options...
frog78 Posted August 17, 2009 Share Posted August 17, 2009 This script is for java applet. Idk if it clicks too fast or something but after working about 30-40 minutes it will crash the java applet. What should I do? Any tips how to make it more smooth? expandcollapse popupGlobal $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{Home}", "Aste") ;~ AutoItSetOption("SendKeyDelay", 320) ;~ Alters the the length of the brief pause in between sent keystrokes. ;~ AutoItSetOption("SendKeyDownDelay", 320) ;~ Alters the length of time a key is held down before being released during a keystroke. ;~ KEERA KAARTI 90 KRAADI AutoItSetOption ("MouseClickDelay", 100); Sleep(Random(3002,4039)) WinActivate ( "Window X") ;~ Siit asi algab $ammount = 0; $step = 1; MouseMove(387,274); Sleep(Random(1384,1478)) While 1 If $step = 1 Then $blue_hat = PixelSearch(424, 111, 500, 700, 0x0000F8, 2); If Not @error Then $red = PixelSearch(387, 274, 500, 700, 0xFF0000, 2); If Not @error Then $coord_1 = $red[0]+Random(-2,1) $coord_2 = $red[1]+Random(-2,1) MouseClick ( "left", $coord_1, $coord_2, 1) Sleep(Random(10,14)); Else $step = 2; EndIf Else ; $step = 5; EndIf EndIf If $step = 2 Then ;~ 185,113 Mouseclick( "left", 185, 113, 1); Sleep(Random(1384,1478)) MouseMove(394,277); Sleep(Random(1384,1478)) $step = 3 EndIf if $step = 3 Then $red_2 = PixelSearch(394, 277, 500, 700, 0xFF0000, 2); if not @error Then $coord_x1 = $red_2[0]+Random(-2,1) $coord_x2 = $red_2[1]+Random(-2,1) MouseClick ( "left", $coord_x1, $coord_x2, 1) Sleep(Random(10,14)); Else $step = 4 EndIf Endif If $step = 4 Then ;closing window MouseClick( "left", 89, 115) Sleep(Random(314,478)) MouseMove(387,274); Sleep(Random(1384,1478)) $ammount = $ammount + 1 if $ammount >= 12 Then $step = 5; Else $step = 1; EndIf EndIf If $step = 5 Then ;searching the witch MouseClick("left", 414+Random(-1,1), 75+Random(-3,3)) Sleep(Random(1384,1478)) $witch = PixelSearch(182, 96, 500, 700, 0x910000, 1); If not @error Then MouseClick ( "left", $witch[0], $witch[1], 1) Sleep(Random(3384,3778)) MouseClick("left", 61+Random(-1,1), 31+Random(-1,1)) Sleep(Random(3384,3778)) $ammount = 0; $step = 1; Else $witch = PixelSearch(182, 96, 500, 700, 0xD00000, 1); If Not @error Then MouseClick ( "left", $witch[0], $witch[1], 1) Sleep(Random(3384,3778)) MouseClick("left", 61+Random(-1,1), 31+Random(-1,1)) Sleep(Random(2384,2778)) $ammount = 0; $step = 1; Else Sleep(Random(1100,1500)) $step = 5; EndIf EndIf EndIf WEnd Func Step() MsgBox(0, "Step", $step); EndFunc ;~ Siit asi lõpeb Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script has been stopped"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Try This: expandcollapse popupGlobal $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{Home}", "Aste") ;~ AutoItSetOption("SendKeyDelay", 320) ;~ Alters the the length of the brief pause in between sent keystrokes. ;~ AutoItSetOption("SendKeyDownDelay", 320) ;~ Alters the length of time a key is held down before being released during a keystroke. ;~ KEERA KAARTI 90 KRAADI AutoItSetOption ("MouseClickDelay", 100); Sleep(Random(3002,4039)) WinActivate ( "Window X") ;~ Siit asi algab $ammount = 0; $step = 1; MouseMove(387,274); Sleep(Random(1384,1478)) While 1 Sleep(10) If $step = 1 Then $blue_hat = PixelSearch(424, 111, 500, 700, 0x0000F8, 2); If Not @error Then $red = PixelSearch(387, 274, 500, 700, 0xFF0000, 2); If Not @error Then $coord_1 = $red[0]+Random(-2,1) $coord_2 = $red[1]+Random(-2,1) MouseClick ( "left", $coord_1, $coord_2, 1) Sleep(Random(10,14)); Else $step = 2; EndIf Else ; $step = 5; EndIf EndIf If $step = 2 Then ;~ 185,113 Mouseclick( "left", 185, 113, 1); Sleep(Random(1384,1478)) MouseMove(394,277); Sleep(Random(1384,1478)) $step = 3 EndIf if $step = 3 Then $red_2 = PixelSearch(394, 277, 500, 700, 0xFF0000, 2); if not @error Then $coord_x1 = $red_2[0]+Random(-2,1) $coord_x2 = $red_2[1]+Random(-2,1) MouseClick ( "left", $coord_x1, $coord_x2, 1) Sleep(Random(10,14)); Else $step = 4 EndIf Endif If $step = 4 Then ;closing window MouseClick( "left", 89, 115) Sleep(Random(314,478)) MouseMove(387,274); Sleep(Random(1384,1478)) $ammount = $ammount + 1 if $ammount >= 12 Then $step = 5; Else $step = 1; EndIf EndIf If $step = 5 Then ;searching the witch MouseClick("left", 414+Random(-1,1), 75+Random(-3,3)) Sleep(Random(1384,1478)) $witch = PixelSearch(182, 96, 500, 700, 0x910000, 1); If not @error Then MouseClick ( "left", $witch[0], $witch[1], 1) Sleep(Random(3384,3778)) MouseClick("left", 61+Random(-1,1), 31+Random(-1,1)) Sleep(Random(3384,3778)) $ammount = 0; $step = 1; Else $witch = PixelSearch(182, 96, 500, 700, 0xD00000, 1); If Not @error Then MouseClick ( "left", $witch[0], $witch[1], 1) Sleep(Random(3384,3778)) MouseClick("left", 61+Random(-1,1), 31+Random(-1,1)) Sleep(Random(2384,2778)) $ammount = 0; $step = 1; Else Sleep(Random(1100,1500)) $step = 5; EndIf EndIf EndIf WEnd Func Step() MsgBox(0, "Step", $step); EndFunc ;~ Siit asi lõpeb Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script has been stopped"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
kanakukk Posted August 17, 2009 Author Share Posted August 17, 2009 It is still using too much memory (lagging), I'm using WinXP SP2, AMD Athlon 64 Processor 3500+, 2.21 GHz. Not the best pc but the worst either. I haven't had problems with autoit until now (maybe it clicks too fast or ...?). Link to comment Share on other sites More sharing options...
eEniquEe Posted August 18, 2009 Share Posted August 18, 2009 (edited) Random function:Generates a pseudo-random float-type number.Random ( [Min [, Max [, Flag]]] )Sleep(Random(3002,4039))Random(3002,4039) will generate a float, it maybe better if you change it to: Sleep(Random(3002,4039, 1)), or Sleep(Int(Random(3002,4039)))$coord_x1 = $red_2[0]+Random(-2,1)$coord_x2 = $red_2[1]+Random(-2,1)MouseClick ( "left", $coord_x1, $coord_x2, 1)coord_x1 and coord_x2 are both floats. Since the x-coordinate, and the y-coordinate to perform a click should be a non-negative integer, so you may consider to change it to: MouseClick ( "left", Int($coord_x1), Int($coord_x2), 1)or$coord_x1 = $red_2[0]+Random(-2,1, 1)$coord_x2 = $red_2[1]+Random(-2,1, 1)MouseClick ( "left", $coord_x1, $coord_x2, 1)That's all I can think of, someone may come over, and spot some other errors, or make some improment. >_<Oh, and btw, performing a click does consume some CPU. It takes around 2%/click for my laptop. You can check it in the Task Manager. Try to widen the time interval between the clicks to see if it helps. Edited August 18, 2009 by eEniquEe Link to comment Share on other sites More sharing options...
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