PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: Skynet on 03 March, 2005, 12:43:52

Title: Fun Script "Batter User" Lua5
Post by: Skynet on 03 March, 2005, 12:43:52
Ringside script converted to lua5

botname="The Angler"                          -- duh, the bot name
sCommand="!batter"                           -- this is the command for main chat
sDescription="Batter User"                   -- this is the description Of Command
sMissBefor=" was going to batter "               -- this is sent after your nick, but before their nick if you miss
sMissAfter=", but scrambles eggs instead!"      -- this is sent after their nick if you miss
sHitBefor=" batters "                         -- this is sent after your nick, but before their nick if you hit
sHitAfter=" with a smelly old cod!"             -- this is sent after their nick if you hit

--  END EDITABLE SETTINGS
function ChatArrival(user, data)
data=string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find( data,"%b<>%s+(%S+)" )
if (cmd=="!ringside") then
user:SendData("Ringside",sCommand.." \t\t"..sDescription)
end
s,e,cmd,arg = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
if (cmd==sCommand) then
if not (arg==nil) then
local tmp = GetItemByName(arg)
if (tmp==nil) then
SendToAll(botname,""..user.sName..sMissBefor..arg..sMissAfter)
end
if not (tmp==nil) then
SendToAll(botname, ""..user.sName..sHitBefor..arg..sHitAfter)
end
return 1
end
end
end  

have fun