You are on page 1of 1

--[[

This is a XenoBot example script, intended to


teach new users about the scripting API and
act as script that is usable in actual play.

enemyAlert_iter.lua - alerting when enemies are


on screen using iterators (for this purpose, this
is slower than enemyAlert_classic.lua)

** DO NOT EDIT THIS FILE. INSTEAD, COPY IT TO


"Documents\XenoBot\Scripts" AND EDIT THE COPY. **
]]--

--set the names of your enemies here


local enemies =
{
"Cachero",
"Bubble",
"Eternal Oblivion",
}

-----------------------------------------------------------------------------------
--------------
-----------------------------------------------------------------------------------
--------------
-----------------------------------------------------------------------------------
--------------

--this continuously loops, executing the code inside over and over again
while (true) do
--this loops over every player on screen
for name, player in Creature.iPlayers() do
--this checks if the player is an enemy
if (table.contains(enemies, name)) then
alert()
break --break exits the inner-most loop
end
end

--this causes the loop to wait 1 second before checking again


wait(1000)
end

You might also like