Kaotix Posted December 22, 2011 Share Posted December 22, 2011 (edited) I'm a noob at coding and the problem I'm having is with getting my script() function to restart every time my reward() function has finished running.Currently my script() function only resumes after reward() has ran ( not restarting).This causes my script() function to run incompletely if the time between when the last cycle ran was too short.To make the script efficient, I need it to stop script() when reward() activates but then restart script() from the beginning afterwards.Any help would be appreciated. thanks!expandcollapse popupGlobal $runscript = False AdlibRegister("reward") While 1 Sleep(500) If $runscript = True Then script() EndIf WEnd Func script() MouseClick("Left", 224, 461, 1) MouseClick("Left", 1606, 274, 1) MouseClick("Left", 1633, 337, 1) MouseClick("Left", 1492, 649, 1) MouseClick("Left", 1729, 863, 1) Sleep(500) MouseClick("Left", 223, 558, 1) MouseClick("Left", 1606, 274, 1) MouseClick("Left", 1633, 337, 1) MouseClick("Left", 1601, 357, 1) MouseClick("Left", 1721, 858, 1) Sleep(500) MouseClick("Left", 223, 658, 1) MouseClick("Left", 1606, 274, 1) MouseClick("Left", 1633, 337, 1) MouseClick("Left", 1601, 357, 1) MouseClick("Left", 1721, 858, 1) Global $runscript = False EndFunc ;==>script Func reward() If PixelGetColor(1643, 356) = 0 Then $runscript = False MouseClick("Left", 1770, 800, 1) Sleep(500) MouseClick("Left", 1770, 800, 1) Sleep(500) MouseClick("Left", 1770, 800, 1) Sleep(1000) $runscript = True EndIf EndFunc ;==>reward Edited December 22, 2011 by Kaotix Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2011 Developers Share Posted December 22, 2011 Please read the forum rules before posting again. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts