JohnOne Posted January 31, 2010 Posted January 31, 2010 Why do you have the ExitLoop and While-Wend statements in this scriptlet?Just modified the OPs code so it is not spamming, and exits his while loop once one of the conditions are met. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
kackagent Posted January 31, 2010 Author Posted January 31, 2010 Why do you have the ExitLoop and While-Wend statements in this scriptlet?sorry, somethings wrong now i copied it and startet it again and the error is gone, but it ends after a few milliseconds. i want it to work forever
JohnOne Posted January 31, 2010 Posted January 31, 2010 sorry, somethings wrong now i copied it and startet it again and the error is gone, but it ends after a few milliseconds. i want it to work forever Then you need to explain a little more clearly and in more detail what you want to do exactly.In your other post you said you only wanted it to send once. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
kackagent Posted January 31, 2010 Author Posted January 31, 2010 yeah sorry for that. my english sucks ... The buttons should be pressed only once if it detects a change in that pixelcolor. but the whole detect and and pressing should be a loop. 1. pixel gets white -> press 1 one time 2. wait till piel is not white -> press 2 one time 3. wait till pixel get white again -> press 1 again 4 ..... hope u understand. ps: thanks for the help and for ur patience.
JohnOne Posted January 31, 2010 Posted January 31, 2010 (edited) lol that sort of logic burns my head out No harm in trying this HotKeySet("{ESC}", "Terminate") Local $switched = False Local $hColour = PixelGetColor (563, 73) While $switched = False Sleep(100) If $hColour = 0xFFFFFF And $switched = False Then $switched = True Send ( "1" ) ElseIf Not $switched And $hColour <> 0xFFFFFF Then Send ( "2" ) EndIf WEnd Func Terminate() Exit EndFunc I've not tested it EDIT: scrap that, its totally wrong and upside down aswell as back to front. It wont work. EDIT 2 : I think this is it HotKeySet("{ESC}", "Terminate") Local $switched = False Local $hColour = PixelGetColor (563, 73) While 1 Sleep(100) If Not $switched And $hColour = 0xFFFFFF Then $switched = True Send ( "1" ) ElseIf $switched And $hColour <> 0xFFFFFF Then Send ( "2" ) $switched = False EndIf WEnd Func Terminate() Exit EndFunc Edited January 31, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
kackagent Posted February 1, 2010 Author Posted February 1, 2010 HotKeySet("{ESC}", "Terminate") Local $switched = False Local $hColour = PixelGetColor (563, 73) While 1 Sleep(100) If Not $switched And $hColour = 0xFFFFFF Then $switched = True Send ( "1" ) ElseIf $switched And $hColour <> 0xFFFFFF Then Send ( "2" ) $switched = False EndIf WEnd Func Terminate() Exit EndFunc it does not work
kackagent Posted February 1, 2010 Author Posted February 1, 2010 While 1 fight() WEnd Func fight() If PixelGetColor (560, 70) = 0xFFFFFF Then Send("1") Else While $zahl = 0 Do $zahl = $zahl + 1 Send("3") Sleep (1000) Send("2") Sleep (2000) Until $zahl = 1 WEnd EndIf EndFunc "Line 79 .... Error: Error in expression."
JohnOne Posted February 1, 2010 Posted February 1, 2010 Trying to follow the thread here, where does this quote come from ? Probably this in the below code While $zahl = 0 While 1 fight() WEnd Func fight() If PixelGetColor (560, 70) = 0xFFFFFF Then Send("1") Else While $zahl = 0 Do $zahl = $zahl + 1 Send("3") Sleep (1000) Send("2") Sleep (2000) Until $zahl = 1 WEnd EndIf EndFunc I think its time you posted your whole code, its as though you are qoting posts from another forum. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
kackagent Posted February 1, 2010 Author Posted February 1, 2010 #include <GUIConstantsEx.au3> GUICreate("AutoIT", 335, 100) GUISetState(@SW_SHOW) If WinExists("XXX") Then WinActivate("XXX") WinWaitActive("XXX") EndIf While 1 fight() WEnd Func fight() If PixelGetColor (560, 70) = 0xFFFFFF Then Send("1") Else Do $zahl = 0 $zahl = $zahl + 1 Sleep (1000) Send("3") Sleep (1000) Send("2") until $zahl = 1 EndIf EndFunc whole code. doesnt stop after sending "3" and "2" one time
JohnOne Posted February 1, 2010 Posted February 1, 2010 #include <GUIConstantsEx.au3> GUICreate("AutoIT", 335, 100) GUISetState(@SW_SHOW) If WinExists("XXX") Then WinActivate("XXX") WinWaitActive("XXX") EndIf While 1 fight() WEnd Func fight() If PixelGetColor (560, 70) = 0xFFFFFF Then Send("1") Else Do $zahl = 0 $zahl = $zahl + 1 Sleep (1000) Send("3") Sleep (1000) Send("2") until $zahl = 1 EndIf EndFunc whole code. doesnt stop after sending "3" and "2" one time Because you never end your while...WEnd loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Developers Jos Posted February 1, 2010 Developers Posted February 1, 2010 whole code. doesnt stop after sending "3" and "2" one time What about you stop posting these remarks after trying something posted by somebody that likely also has no clue what you really want and start understanding what that script you are trying to run actually does! That would enable you to think for yourself and code something that does what you want.Jos 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.
kackagent Posted February 1, 2010 Author Posted February 1, 2010 Because you never end your while...WEnd loop.because the whole thing should be an endless loop. but the single things in the loop shouldnt be endless.What about you stop posting these remarks after trying something posted by somebody that likely also has no clue what you really want and start understanding what that script you are trying to run actually does! That would enable you to think for yourself and code something that does what you want.Josi am new to this whole coding thing ... i know what my code shall do ... i do NOT understand completely what my code actualy does. i try everything i can, but its kinda hard, my english sucks and i dont understand everything said here. sorry for that.
kaotkbliss Posted February 1, 2010 Posted February 1, 2010 (edited) what game are you trying to bot? maybe try this? HotKeySet("{ESC}", "Terminate") $check=1 While 1 $color=PixelGetColor(563, 73) If $color=0xFFFFFF And $check=1 Then Send ( "1" ) $check=2 ElseIf $color<>0xFFFFFF And $check=2 Then Send ( "2" ) $check=1 EndIf WEnd Func Terminate() Exit EndFunc Edited February 1, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
Developers Jos Posted February 1, 2010 Developers Posted February 1, 2010 i am new to this whole coding thing ... i know what my code shall do ... i do NOT understand completely what my code actualy does. i try everything i can, but its kinda hard, my english sucks and i dont understand everything said here. sorry for that.Stop trying and start understanding is the clear message here.In layman terms: Learn to crawl before running the marathon and start reading, studying and understanding the basics.Come back when you have question about the syntax...Jos 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.
Recommended Posts