Mindee-BOT

Mindee-BOT Community => Share => Scripting => Useful Parts => Topic started by: =Mindee= on June 28, 2020, 02:33:35 pm

Title: [Share] Go to tile with specified sprite id and do stuff.
Post by: =Mindee= on June 28, 2020, 02:33:35 pm
Script:
Code: [Select]
# Sprite ids can be found here: https://mindee-bot.com/forum/index.php/topic,1834.0.html
sprite_id = 2600 # 2600 = portal

def onReachedTileLocation(spriteId, location, inline):
script.StatusMessage('Reached: ' + str(location) + ' id: ' + str(spriteId))
script.Say('Hello world!')
script.ForgetLocation() # Call this when ready to move away.

def onChangeLocation(x, y, z):
if not script.HasTarget():
pos = script.FindSprite(sprite_id) # portal sprite
if pos != None: # Found sprite
script.StatusMessage('Found tile at: ' + str(pos))
success = script.GoToTile(pos, sprite_id, False)
if success: # Error checking is optional
script.StatusMessage('Going to: ' + str(pos))
else:
script.StatusMessage('Error going to: ' + str(pos))