Shine Getter help

I’m sorry for posting again, but i’m trying my best to learn and i’m struggling.

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.
        hero.moveXY(coins.pos.x, coins.pos.y)
    coinIndex += 1
pass

It’s mostly a structure problem. The if coin.value ==3: conditional and the incremental statement should be inside the while coinIndex loop. Also, your move statement X & Y positions should be singular.

nothing to be ashamed of except possibly embarrassment.

and, you could only go to one coin at a time. instead of coins.pos.x, replace coins for coin. do the same for y position.

This is my code now but nothing changed. :frowning:

while True:
coins = hero.findItems()
coinIndex = 0

# Wrap this into a loop that iterates over all coins.
while coinIndex < len(coins):
    coin = coins[coinIndex]
    if coin.value == 3:
        # Only pick up gold coins.
        hero.moveXY(coin.pos.x, coin.pos.y)
coinIndex += 1

pass

Half your code isn’t formatted so I can’t see the structure. Please put all of it inside the triple back ticks.

while True:
coins = hero.findItems()
coinIndex = 0

# Wrap this into a loop that iterates over all coins.
while coinIndex < len(coins):
    coin = coins[coinIndex]
    if coin.value == 3:
        # Only pick up gold coins.
        hero.moveXY(coin.pos.x, coin.pos.y)
coinIndex += 1
pass

Experiment with your code. There’s one line that needs to be tabbed over. The code is correct, the structure is the issue.

To the left or to the right?

Seriously? Code Combat is a learning tool. Learning to code is extremely difficult if someone just gives you the answers. Please experiment with your code and learn. Make sure all of your code is inside the while true loop.

Remember, you’re trying to loop all code inside it. So all of the code you want to be looped has to be inside the while true loop. So all code you want to be looped has to be indented in the loop. Please make a better effort than this, debugging involves experimenting with code.

At this point I would highly recommend going back and reviewing/redoing some previous levels. There are some basic concepts involving structure that must be learned and without an understanding of those concepts, it’s only going to get more difficult from here.

with this, you can’t do anything, except watching beautiful coins.

i cant do this it just donst move my character

Can you please post your code so we can help?

return #Commented out to stop infinite loop.

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)
        pass

i dont know why it dosnt move

It’s because you’ve commented out. Remove that line.

i tryed that it still dosnt work

Where is the coin+=1?

hello? Chaboi are you still here