Jump to content

could anyone check this >_>


zutto
 Share

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...