The code never progresses past the friends = line, so no idea if one of my attempts (shown) even helps. Code:
def commandTroops():
friends = hero.findFriends()
if friends == None:
pass
else:
for x in len(friends):
friend = friends[x]
if friend.type == "paladin":
CommandPaladin(friend)
elif friend.type == "soldier" or friend.type == "archer" or friend.type == "griffin-rider":
CommandSoldier(friend)
elif friend.type == "peasant":
CommandPeasant(friend)
I’m betting it’s something simple, but darned if I see it. Oh…at this point, I no longer have any friends left alive and not yet enough gold to summon more.
Deadpool is right about this error. But I think your main error is elsewhere:
Type this code in completely void level (https://codecombat.com/play/level/forest-flower-grove?)
( I suppose you have the most advanced glaces)
items = hero.findItems();
friends = hero.findFriends()
enemies = hero.findEnemies()
ogres = hero.findByType("ogre")
friendlyMissiles = hero.findFriendlyMissiles()
enemyMissiles = hero.findEnemyMissiles()
hazards = hero.findHazards()
if items and friends and enemies and ogres and friendlyMissiles and enemyMissiles and hazards:
hero.say("Maybe they are all of Dark Material")
else:
hero.say("Nothing here")
@Deadpool198 thanks…changing to the common python method was the trick.
@xython Thanks again…after trying it with both the enchanted lenses and twilight glasses, I saw dark matter both times, I think I realized your point. I modified the code to utilize the ‘for i in range’ method, for each unit type and I never saw a thing. Lesson well learned