# To grab the most gold quickly, just go after gold coins.
while True:
coins = hero.findItems()
coinIndex = 0
# Wrap this into a loop that iterates over all coins.
while coinIndex < len(coins):
coin = coins[coinIndex]
# Gold coins are worth 3.
if coin.value == 3:
# Only pick up gold coins.
coin = coins[coinIndex]
hero.moveXY(coin.pos.x, coin.pos.y)
coinIndex += 1
pass
I click run yet nothing happens not even an error just says “running…”
I have been stuck for a while not knowing if it is a bug or just my code,
so I decided to post here after looking all over google and here.
while True:
coins = hero.findItems()
coinIndex = 0
return
# Wrap this into a loop that iterates over all coins.
while coinIndex < len(coins):
coin = coins[coinIndex]
# Gold coins are worth 3.
if coin.value == 3:
# Only pick up gold coins.
hero.moveXY(coin.value.x, coin.value.y)
pass
Hi,
There are a few problems in here, I’ll tell you the biggy: you’ve put a return in your code this means it will keep going back to the top.
After you’ve got rid of that, there are some other problems but I think you might be able to fix them now.
Danny