def letterIndex(word, letter):
# Step through each letter as an index of the word.
while chestIndex < len(ogreLetter):
# Store a character from the word with the current index.
letterIndex.append(shaman)
# If it is the required letter:
if ogreLetter:
# Then return the current index (number).
return chestIndex
# If nothing, return a default value
else:
return -1
ogreLetter = "z"
shaman = hero.findByType("thoktar")[0]
# Find the index and use it for finding the treasure.
chestIndex = letterIndex(shaman.id, ogreLetter)
hero.moveXY(16 + chestIndex * 8, 36)
This is the error:

Lydia
