Hello.
You can use this script to try to detect if a monster has been summoned or if you got teleported, but that depends on effects that shows up.
I don't believe that there's a way to make 100% sure that a monster was summoned, because it could be respawn or even a creature summon (like orc shaman with snakes).
I can tell you two options that I have in my mind now that you could do to check that, but not sure if it's 100%. Both methods are not 100% accurate, but worth to try.
1. gettileeffect(number posx, number posy, number posz) or gettileseffect(). You can use those functions to detect effects on sqm like healing effect (shinning stars), etc.
Example: This script will play sound, flash client whenever there's a effect in any tile in your screen.
The script above would not be good, because healing would trigger that. So you could check for specific effects only:
How to find effect id? Simple. Just reproduce the effect, make it happen in your screen and run the script below. You must do it really fast (you can let the script running on a persistent with low intervals). For example: If you wanna find the blue ball effect (that shows up when you login and perhaps when you get teleported, not sure if when gm does that you get that effect) then let the script running on persistents with low interval (like 100ms) and relog.
You can use this script to try to detect if a monster has been summoned or if you got teleported, but that depends on effects that shows up.
I don't believe that there's a way to make 100% sure that a monster was summoned, because it could be respawn or even a creature summon (like orc shaman with snakes).
I can tell you two options that I have in my mind now that you could do to check that, but not sure if it's 100%. Both methods are not 100% accurate, but worth to try.
1. gettileeffect(number posx, number posy, number posz) or gettileseffect(). You can use those functions to detect effects on sqm like healing effect (shinning stars), etc.
Example: This script will play sound, flash client whenever there's a effect in any tile in your screen.
local tilesEffects = gettileseffect()
for _, tile in ipairs(tilesEffects) do
if tile.count > 0 then
playsound('default')
flashclient()
pausebot(true)
end
end
The script above would not be good, because healing would trigger that. So you could check for specific effects only:
local EFFECTS = { 11 } -- Effects ids
local tilesEffects = gettileseffect()
for _, tile in ipairs(tilesEffects) do
for __, effect in ipairs(tile.effects) do
if table.find(EFFECTS, effect) ~= nil then
playsound('default')
flashclient()
pausebot(true)
end
end
end
How to find effect id? Simple. Just reproduce the effect, make it happen in your screen and run the script below. You must do it really fast (you can let the script running on a persistent with low intervals). For example: If you wanna find the blue ball effect (that shows up when you login and perhaps when you get teleported, not sure if when gm does that you get that effect) then let the script running on persistents with low interval (like 100ms) and relog.
local tilesEffects = gettileseffect()
for _, tile in ipairs(tilesEffects) do
for __, effect in ipairs(tile.effects) do
print('effect id:', effect)
end
end