Jump to content
Sign in to follow this  
zutto

could anyone check this >_>

Recommended Posts

zutto

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

Share this post


Link to post
Share on other sites
Valuater

you can not "call" a UDF inside a UDF over and over again

... not tested

#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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
Richard Robertson

Don't #include inside a function. By convention, includes should be at the top of the file for organization.

Share this post


Link to post
Share on other sites
zutto

you can not "call" a UDF inside a UDF over and over again

... not tested

#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 by zutto

Share this post


Link to post
Share on other sites
Valuater

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 also

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

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

I dont understand, so I cant help you.... sorry

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
zutto

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 by zutto

Share this post


Link to post
Share on other sites
Valuater

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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
zutto

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 :E

you mean that global or?

and i dont see point using funcs since that is going to be called from other funcs :|

Share this post


Link to post
Share on other sites
Richard Robertson

@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.

Share this post


Link to post
Share on other sites
zutto

@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.

Share this post


Link to post
Share on other sites
autoitnoob69

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

Share this post


Link to post
Share on other sites
Confuzzled

Nested calls...

post-6470-1220170925_thumb.jpg

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×