dont know how to make this scripts but for teleport : in config.lua
it will teleport when player far away (12-15) square(include teleport)
i make a bot(for fun) it teleport when master change floor, auto-attack... but edit source, maybe someone will post a script for you.