[Solved] Help with mined gems


#1

here is my code. My hero just stands there

# Collect 4 gems. Don't touch gems from the inner circle.

# The radius of the gem-trap circle.
innerRadius = hero.distanceTo(hero.findNearestItem())

# This function check that a is definitely greater than b.
def definitelyGreater(a, b):
    return a > b + 0.5

center = {"x": 40, "y": 34}
gems = hero.findItems()

# Iterate all gems:
for gem in gems:
    # Use definitelyGreater to check if a gem's distance
    # is greater than the inner radius:
    if len(definitelyGreater > innerRadius):
        # Collect the gem.
        hero.moveXY(gem.pos.x, gem.pos.y)
        # Return to the center.
        hero.moveXY(40, 34)


#2

I’m not sure why it isn’t working. Im probably making a rookie mistake :sob: @Chaboi_3000 or @SuperSmacker since you guys are online could you help me pls


#3

It is a rookie mistake. You called on the definitelyGreater function wrong.


#4

How do i call it properly again? Sorry I forgot


#5

Look at how the function is defined. Then look at how you called it.


#6

Oooooh. But what do i put in for a, b?


#7

innerRadius and distance to gem


#8

so i would do if len(definitelyGreater, hero.distanceTo(gem) < innerRadius @SuperSmacker


#9

Dude. why do you need len? I don’t get it dude. Why are you so obsessed with len? I already told you what to do, how to call on the function, what variables to input. It’s up to you to figure it out now.


#11

If I tell you I would literally give the answer away.