This is more of a general Python question.
Typing in coordinates is repetitive and annoying, so I’ve been trying to write defs and stuff to avoid having to do it more than I need to, and I noticed something on this level (I’ve not tried this before until now).
If I try to store my hero’s position as a variable using hero.pos; the value in the variable will automatically change as the hero moves without me updating it. I was trying to just grab the hero’s starting position so I could return to it:
start = hero.pos # Trying to store the hero's starting position so he can just walk back to it.
while True:
# Get an array of enemies.
enemies = hero.findEnemies()
# If the array is not empty.
if len(enemies) > 0:
# Attack the first enemy from "enemies" array.
hero.cast("drain-life", enemies[0])
# Return to the start position.
hero.moveXY(start.x, start.y)
hero.say(start) # Hero says their current position, rather than the original position
pass
So… is there a way I can deference the current hero.pos to store that value as a variable?