Shine Getter help [SOLVED]


#1

Can someone help me with my code, please?

# 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):
        
        # Gold coins are worth 3.
        if coins.value == 3:
            # Only pick up gold coins.
            hero.moveXY(coins.pos.x, coins.pos.y)
        coinIndex += 1
    pass
        

hero won’t move


#2

coins is defined as an array, not a single item, so there is no single position to move to. You have to define coin and then move to the coin.pos.


#3

Can you show me how to do that?


#4

coin = coins[coinIndex]

Remember this chunk of code. You’re going to be seeing this format a LOT.


#5

Like this

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 coins.value == 3:
            # Only pick up gold coins.
            hero.moveXY(coins.pos.x, coins.pos.y)
        coinIndex += 1
    pass

#6

you still didn’t change the places where you refer to coins instead of coin.


#7

like this

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 coins.value == 3:
            # Only pick up gold coins.
            hero.moveXY(coin.pos.x, coin.pos.y)
        coinIndex += 1
    pass


#8

I figured it out now