Code was working then I edited one area and it said this error on Line 73, which I think was just something like if enemy, and it started giving this error so I adjusted it and error wouldn’t go away. I put nothing on line 73 and still got the error.
Logged out and logged in and still got it.
Shortened length of code so that there is no Line 73. Ends at Line 72. Still getting it.
def escapeLeft():
escapePos = {'x': self.pos.x - 8, 'y': self.pos.y}
if self.isPathClear(self.pos, escapePos):
self.moveXY(self.pos.x - 8, self.pos.y)
else:
break
def escapeRight():
escapePos = {'x': self.pos.x + 8, 'y': self.pos.y}
if self.isPathClear(self.pos, escapePos):
self.moveXY(self.pos.x + 8, self.pos.y)
else:
break
def escape():
for enemy in enemies:
if enemy and self.distanceTo(enemy) < 8:
if enemy.pos.x < self.pos.x:
escapeRight()
continue
elif enemy and enemy.pos.x > self.pos.x:
escapeLeft()
continue
loop:
corpses = self.findCorpses()
nearCorpses15 = []
nearEnemies10 = []
enemies = self.findEnemies()
enemy = self.findNearest(enemies)
escape()
for enemy in enemies:
if enemy and self.distanceTo(enemy) < 25:
if self.isReady("confuse"):
self.cast("confuse", enemy)
continue
for enemy in enemies:
if enemy and enemy.health > 0:
self.cast("drain-life", enemy)
break
enemy = self.findNearest(enemies)
if enemy and self.distanceTo(enemy) < 25:
if self.isReady("fear"):
self.cast("fear", enemy)
enemy = self.findNearest(enemies)
if enemy and self.distanceTo(enemy) < 25:
if self.isReady("poison-cloud"):
self.cast("poison-cloud", enemy)
escape()
for enemy in enemies:
if self.distanceTo(enemy) < 10:
nearEnemies10.append(enemy)
for corpse in corpses:
if self.distanceTo(corpse) < 15:
nearCorpses15.append(corpse)
if len(nearCorpses15) > 5:
if self.isReady("raise-dead"):
self.cast("raise-dead")
if self.isReady("summon-undead"):
self.cast("summon-undead")
=====================
edit: Tried again today and my last line of code is on line 70 with the invisible end character marker on line 71. I reloaded the level and with no code I get no error. Pasted my code in again and it’s complaining about nonexistent line 74 again.
From what I can tell def escapeLeft() is improperly indented, and I don’t think you can break out of a Python function. (Maybe break is expecting a labeled loop statement in those cases, which I know is possible in JavaScript, though I doubt used often.)
I first removed the break from escapeRight(), because it was the first instance I saw, and the error message went away but the error X on my hero did not. Then I also removed it from escapeLeft() and there is no more error.
The breaks were a remnant of a loop that no longer exists.