My Python looks like this:
enemy = hero.findNearestEnemy()
if not enemy.type is "peon":
item = hero.findNearestItem()
itemx = item.pos.x
itemy = item.pos.y
if item.type != "poison":
I can defeat all the enemies but I'm left with one gem every time.
I used the same code as s1mpsonn in the beginning, and that didn't work either.