01-09-2015, 02:14 PM
I think a very failsafe approach for checkmainscreen is adding a small tweak like this:
modify waitmainscreen to include only the check and return true if main screen, otherwise return false
waitmainscreen()
while 1
if detect message, click reload, wait 5 sec, exitloop
else
if attacked, click okay, wait 1 sec
if things are opened, click away, wait 1 sec
if x button, click x, wait 1 sec
if chat, click close chat, wait 1 sec
if victory or defeat scene, click return home, wait 5 sec
if end battle button, click end battle, wait 5 sec
endif
if main screen, return true, else return false
exitloop
wend
--------------------------------------------------------
checkmainscreen()
if not in main screen (the 284, 28 check)
while not waitmainscreen()
if 10 minutes passed relaunch BS (ensure not 6 hour break, take 2~4 minutes to get to mainscreen)
wend
endif
--------------------------------------------------------
It can handle 6 hour break as well and doesn't have to use _sleep, if break message appear anywhere during the process bot just run until getresource () and call checkmainscreen() again (it will loop and click reload every 5 sec)
I think we should discuss on the approach first before implementing in code, so it can be optimized more easily before actual release
modify waitmainscreen to include only the check and return true if main screen, otherwise return false
waitmainscreen()
while 1
if detect message, click reload, wait 5 sec, exitloop
else
if attacked, click okay, wait 1 sec
if things are opened, click away, wait 1 sec
if x button, click x, wait 1 sec
if chat, click close chat, wait 1 sec
if victory or defeat scene, click return home, wait 5 sec
if end battle button, click end battle, wait 5 sec
endif
if main screen, return true, else return false
exitloop
wend
--------------------------------------------------------
checkmainscreen()
if not in main screen (the 284, 28 check)
while not waitmainscreen()
if 10 minutes passed relaunch BS (ensure not 6 hour break, take 2~4 minutes to get to mainscreen)
wend
endif
--------------------------------------------------------
It can handle 6 hour break as well and doesn't have to use _sleep, if break message appear anywhere during the process bot just run until getresource () and call checkmainscreen() again (it will loop and click reload every 5 sec)
I think we should discuss on the approach first before implementing in code, so it can be optimized more easily before actual release