Reputation: 65
I'm scratching my head on how I would do this last check after the 5-minute pause to see if I have regenerated enough Health to continue or not. I'll post the current loop below:
the order it should execute is as follows: Starts hunting without issue > It knows how much Health it currently has > When below 8000 health it will pause for 5 minutes as attended > But will not check to see if above 8000 health to continue after the pause > if not above it should keep waiting.
while health >= 8000:
health = letBattle()
if health <= 8000:
driver.get("https://s3-en.bitefight.gameforge.com:443/profile/index")
print("////// RESTING FOR 5 MINUTES TO RECOVER! //////")
time.sleep(300)
#ADD HEALTH CHECK
driver.get("https://s3-en.bitefight.gameforge.com:443/profile/index") #Refresh HP
else:
print("------FINDING NEW PREY!------")
Under #ADD HEALTH CHECK is where I then refresh the browser to view the new updated health... but it just ends and doesn't loop. While above 8000 health it knows to keep hunting over and over again which is great... But when it triggers the pause when below 8000 health, it does nothing and it completely stops instead of continuing to wait until it's above 8000 health again to keep running infinitely.
Thanks in advance for the help/insight into my issue
Upvotes: 1
Views: 98
Reputation: 706
it should be something like this:
while True:
health = # getting health value
if health >= 800:
# do something
else:
sleep(300)
Upvotes: 2