Most efficient way to code this?

13 posts in this topic

adroitful 0

Well, my program works great, but it seems to get an error after a while saying it's using too many resources and it needs to be shut down to prevent an overflow. My question is what is the cause of this error and what is the most efficent way to code this? It just seems like there would be a better way. Thanks for any input

Share this post

Link to post

Share on other sites

adroitful 0

In the code you have posted, you haven't closed any of the If statements or the Function itself. Also, where does _ImageSearch() come from and what is it doing?

I seriously hope you have more code than this because the code you have posted can't even be run by itself. We could help you better if you post it all at once, or at least the full functions pickit() and _ImageSearch().

Yea, I have alot more code. I'll post the whole thing. Imagesearch scans the screen for an image and if it's there, it returns 1 if not, 0. As far as the if statements go, they seem to work just fine. Why would I have to close the if statements?

Share this post

Link to post

Share on other sites

Authenticity 12

One line If..Then doesn't require EndIf, only multiple lines if statement. This ImageSearch library is using an external dll (probably made by the author) so it can be possible there is a memory leak problem in the dll, or not.

Share this post

Link to post

Share on other sites

adroitful 0

One line If..Then doesn't require EndIf, only multiple lines if statement. This ImageSearch library is using an external dll (probably made by the author) so it can be possible there is a memory leak problem in the dll, or not.

I've had the memory problem before. It seems to do this when the code is constantly executed. I don't remember how I was told to fix it tho. I'll try and get it to come back up so I can screenshot it, but it takes a few hours. Also, I didn't think I had to have an endif statement for 1 line if's lol. I'm asking if theres a more efficient way to code all of those if... then statements?