while True:
item = hero.findNearestItem()
# A silver coin has a value of 2.
# Collect if item.type is equal to "coin"
# AND item.value is equal to 2.
if item.type == "coin" and item.value == 2:
hero.moveXY(item.pos.x, item.pos.y)
# A blue gem has a value of 10.
# Collect if item.type is equal to "gem"
# AND item.value is equal to 10.
item = hero.findNearestItem()
if item.type == "gem" and item.value == 10:
hero.moveXY(item.pos.x, item.pos.y)
Please format your code by highlighting it and pressing the < / > button. Alternatively, you can use three backticks ``` (usually above the tab button on the keyboard) at the beginning and end of the code.
Just from looking at what you’ve posted, I can’t see anything wrong with your code. I would suggest mixing up the gear on your character (take off a speed ring if you have it, put one on if you didn’t wear one before, etc). The only change that you could make to your code is that you don’t need the second item = hero.findNearestItem() .