So instead of saying the password word according to the index, he says the letter according to the index.
I feel like I did most of the things right. What happened here?
# Find the password for the gates and defeat the ogres.
# Get the secret message.
hero.moveXY(52, 50)
friend = hero.findNearest(hero.findFriends())
message = friend.message
# Get the separator symbol.
hero.moveXY(66, 34)
friend = hero.findNearest(hero.findFriends())
separator = friend.separator
hero.say(separator)
# Get the index.
hero.moveXY(52, 18)
friend = hero.findNearest(hero.findFriends())
index = friend.index
# Move to the gates.
hero.moveXY(44, 34)
# Split `message` with `separator` to get an array:
message.split(separator)
# Get the password from the array of words by `index`:
password = message[index]
# Say the password:
hero.say(password)
# Defeat the ogres:
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)