Share this post

Link to post

Share on other sites

SmOke_N 178

I agree with MHz, if you take a look at the help file under HotKeySet() you may take a close look at TogglePause() and how it can change thoughout the script yet still retain a certain value at the same time.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post

Link to post

Share on other sites

neogia 0

#include <Coroutine.au3>$mainFunction=_CoCreate('Func mainFunction()| ;Not really sure what you want to do in your main loop, but this is what you had:|While 1| ;do some stuff| ;create a gui| ToolTip("Main script still running.", 0, 0)| Sleep(1500)|WEnd|EndFunc')$pid=_CoStart($mainFunction)While1IfPixelGetColor(100,100)=="0x8e5a00"Then; Some color_CoKill($pid)MsgBox(0,"ruh-roh","Bail Man, Bail!")_CoCleanup()ExitEndIfSleep(10)WEnd

Of course this is just a very simple example, but hopefully you get the picture.

Share this post

Link to post

Share on other sites

beestinga 0

#include <Coroutine.au3>$mainFunction=_CoCreate('Func mainFunction()| ;Not really sure what you want to do in your main loop, but this is what you had:|While 1| ;do some stuff| ;create a gui| ToolTip("Main script still running.", 0, 0)| Sleep(1500)|WEnd|EndFunc')$pid=_CoStart($mainFunction)While1IfPixelGetColor(100,100)=="0x8e5a00"Then; Some color_CoKill($pid)MsgBox(0,"ruh-roh","Bail Man, Bail!")_CoCleanup()ExitEndIfSleep(10)WEnd

well, I'm not sure I entirely get the picture. I sort of get it, but I'm not sure how to implement it.

To add this feature to my existing code, would I just put all of my code into that _CoCreate( function? Currently, my code consists of many different functions, all flopping around and calling one another and all of these fancy things. It's about 300 lines right now - would that all go into the _CoCreate function?

Also, I noticed you're using while loops. If the condition is met:

If PixelGetColor(100,100) == "0x8e5a00"

in the middle of stuff happening, will it still trigger? because my understanding was that in while loops, it checks to see if the paramter is true only at the end of it.

Sorry if I come across as dense, but I'm still very new to this.

Your help is really genuinely appreciated, though.

Share this post

Link to post

Share on other sites

neogia 0

I've in fact taken your specific situation into account already. If I have a main body of code, you can include "helper" functions using _CoInclude(). What I would do is this. Say I have this as my script (very much shorter than 300 lines, mind you).

Then yes, the "check" is placed at the beginning of the loop and only at the beginning. In my script, the while loop only serves to create an infinite loop. I placed my own "check" inside the loop. In that case, PixelGetColor(...) is only checked at the If statement, and only at the If statement, once every loop. In its current implementation, you'll get about 95-99 PixelGetColor(...) checks per second, which should be rather accurate to put an immediate stop to your child script.

Share this post

Link to post

Share on other sites

beestinga 0

I've in fact taken your specific situation into account already. If I have a main body of code, you can include "helper" functions using _CoInclude(). What I would do is this. Say I have this as my script (very much shorter than 300 lines, mind you).

Then yes, the "check" is placed at the beginning of the loop and only at the beginning. In my script, the while loop only serves to create an infinite loop. I placed my own "check" inside the loop. In that case, PixelGetColor(...) is only checked at the If statement, and only at the If statement, once every loop. In its current implementation, you'll get about 95-99 PixelGetColor(...) checks per second, which should be rather accurate to put an immediate stop to your child script.

Hope that wasn't overload.

OK, do you just use pipes instead of line breaks, or is that really how my code should look?