Jump to content

Recommended Posts

Posted (edited)

Alright i'm working on a function for my script and I just need to know how to get it to repeat till it comes back positive

It's an image search and I just need it to keep searching for the image till it finds it. After it's found I need it to end function.

I'm pretty new to scripting so :s

I already have

Func HungerCheck()

_ImageSearch("Ego.bmp",1,$ex,$ey,30)

I just need it to keep repeating image search till found then EndFunc

Edited by Atonement
Posted

Func HungerCheck()
While 1 
$ImageSerchResult = _ImageSearch("Ego.bmp",1,$ex,$ey,30)
If $ImageSerchResult = Whatever _ImageSearch outputts when it has found the image Then ExitLoop
Wend

Where do you get the _ImageSearch function from?

Because i cant find it in the helpfile.

All it needs is the output it gives when it finds the image.

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Posted

@Atonement

Func HungerCheck()

_ImageSearch("Ego.bmp",1,$ex,$ey,30)

That looks like it could be game-related. You did read the forum-rules before posting, right?

@Maffe811

Where do you get the _ImageSearch function from?

Because i cant find it in the helpfile.

All it needs is the output it gives when it finds the image.

Do a search for _ImageSearch in the examples forum and you'll only get one result. That's most likely where it came from.
Posted

In that case my code should either be

*Removed*

or

Func HungerCheck()
While 1 
$ImageSearchResult = _ImageSearch("Ego.bmp",1,$ex,$ey,30)
If $ImageSearchResult = 1 Then ExitLoop
Wend

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

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
×
×
  • Create New...