Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Level "Shine Getter", Nothing Happening? Python

#1

This is my code,

# 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.

#2

Your code may be too long. Make sure you have the right equipment…

1 Like
#3

Could you send a screenshot?

2 Likes
#4

It could be that you have a dead / infinite loop by accident or your computer is running slow.

2 Likes
#5

#Do not put
coinIndex += 1
#in “if statement”.

4 Likes
#6

Thank you jack! This worked I had no idea that was what I was doing wrong.

1 Like
#7

Bravo! same problem and same solution!