zutto Posted August 31, 2008 Posted August 31, 2008 yeah so i am creating.. once again script wich isnt working ^^ for some reason this isnt working inside func :E but when i take the func off it works perfectly so any ideas whats wrong? func inz() $x1=0 $y1=0 #include <ImageSearch.au3> sleep(3000) $result3 = _ImageSearch("in.bmp",1,$x1,$y1,0) if $result3=1 Then tooltip("not in! calling inz!", 0,0) sleep(5000) mouseclick("left", 628, 413) sleep(3000) send("x") sleep(2000) send("{enter}") sleep(4000) mouseclick("left", 638, 597) endif call("inz") endfunc
Valuater Posted August 31, 2008 Posted August 31, 2008 (edited) you can not "call" a UDF inside a UDF over and over again ... not tested expandcollapse popup#include <ImageSearch.au3> Global $Paused, $Ender, $x1 = 0, $y1 = 0 HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") Do Sleep(3000) $result3 = _ImageSearch("in.bmp", 1, $x1, $y1, 0) If $result3 = 1 Then ToolTip("not in! calling inz!", 0, 0) Sleep(5000) MouseClick("left", 628, 413) Sleep(3000) Send("x") Sleep(2000) Send("{enter}") Sleep(4000) MouseClick("left", 638, 597) EndIf Until $Ender =1 ; -------------- Functions ---------------- Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() $Ender = 1 EndFunc 8) Edited August 31, 2008 by Valuater
Richard Robertson Posted August 31, 2008 Posted August 31, 2008 Don't #include inside a function. By convention, includes should be at the top of the file for organization.
zutto Posted August 31, 2008 Author Posted August 31, 2008 (edited) you can not "call" a UDF inside a UDF over and over again ... not tested expandcollapse popup#include <ImageSearch.au3> Global $Paused, $Ender, $x1 = 0, $y1 = 0 HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") Do Sleep(3000) $result3 = _ImageSearch("in.bmp", 1, $x1, $y1, 0) If $result3 = 1 Then ToolTip("not in! calling inz!", 0, 0) Sleep(5000) MouseClick("left", 628, 413) Sleep(3000) Send("x") Sleep(2000) Send("{enter}") Sleep(4000) MouseClick("left", 638, 597) EndIf Until $Ender =1 ; -------------- Functions ---------------- Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() $Ender = 1 EndFunc 8) yeh but it needs to be inside func so i can call it :E edit: thats only litle part of the full code :| but thats the part wich isnt working.. no erros, console isnt saying anything it just dont find it when inside func :E Edited August 31, 2008 by zutto
Valuater Posted August 31, 2008 Posted August 31, 2008 Don't #include inside a function. By convention, includes should be at the top of the file for organization.... and the other "formating" I used above also8)
Valuater Posted August 31, 2008 Posted August 31, 2008 yeh but it needs to be inside func so i can call it :Eedit:thats only litle part of the full code :| but thats the part wich isnt working.. no erros, console isnt saying anything it just dont find it when inside func :EI dont understand, so I cant help you.... sorry8)
zutto Posted August 31, 2008 Author Posted August 31, 2008 (edited) still isnt working :| looks like atm: sleep(3000) $x1=0 $y1=0 #include <imagesearch.au3> func inz() Do Sleep(3000) $result3 = _ImageSearch("in.bmp", 1, $x1, $y1, 0) If $result3 = 1 Then ToolTip("not in! calling inz!", 0, 0) Sleep(5000) MouseClick("left", 628, 413) Sleep(3000) Send("x") Sleep(2000) Send("{enter}") Sleep(4000) MouseClick("left", 638, 597) EndIf Until $result3 = 1 endfunc Edited August 31, 2008 by zutto
Valuater Posted August 31, 2008 Posted August 31, 2008 (edited) Don't #include inside a function. By convention, includes should be at the top of the file for organization.also... do you see the "format" i gave you above???8) Edited August 31, 2008 by Valuater
zutto Posted August 31, 2008 Author Posted August 31, 2008 also... do you see the "format" i gave you above???8)erm i am not that good with autoit so i didnt get the point :Eyou mean that global or?and i dont see point using funcs since that is going to be called from other funcs :|
Richard Robertson Posted August 31, 2008 Posted August 31, 2008 @Valuator: You posted while I was replying so I didn't see yours. ^^; @zutto: Is your native language English? If it is, you don't appear to have a good grasp on communicating what it is you are trying to do.
zutto Posted August 31, 2008 Author Posted August 31, 2008 @Valuator: You posted while I was replying so I didn't see yours. ^^;@zutto: Is your native language English? If it is, you don't appear to have a good grasp on communicating what it is you are trying to do.its not :|lol now i got it..but still not working :| still always fails.
autoitnoob69 Posted August 31, 2008 Posted August 31, 2008 I think this is what you are trying to do. If it is not what you needed try and explain again cause when i saw your first post it looked like you wanted to just Loop the FUNC over and over when you werent in. #include <ImageSearch.au3> HotKeySet("{ESC}","Exit_Script") Global $x1=0 Global $y1=0 Global $in="in.bmp"; Script has to be in the same folder as in.bmp. ;If in.bmp is in another folder then do "..../in.bmp" Replace the .... the folder it is in Do $result3 = _ImageSearch($in,1,$x1,$y1,10) If $result3=1 Then MouseMove($x1,$y1,10) tooltip("not in! calling inz!", 0,0) call("inz") Else tooltip("currently in",0,0) EndIf Until $result3=1 Func inz() sleep(5000) mouseclick("left", 628, 413) sleep(3000) send("x") sleep(2000) send("{enter}") sleep(4000) mouseclick("left", 638, 597) EndFunc Func Exit_Script () Exit 0 EndFunc
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