Username: Password:

Author Topic: [Share] Go to tile with specified sprite id and do stuff.  (Read 2640 times)

Offline =Mindee=

  • Commander Shepard
  • BOT Developer Administrator
  • Dragon
  • *****
  • Posts: 2,818
  • Cookies 9022
  • We'll bang, OKAY?
    • View Profile
    • http://mindee-bot.com
[Share] Go to tile with specified sprite id and do stuff.
« 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))




Mindee-BOT creator, founder and developer.