PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: TTB on 17 October, 2005, 15:35:18

Title: Bot Reply-er
Post by: TTB on 17 October, 2005, 15:35:18
Hi,

Was a request, finished it, and here is it published.

-- Automatic BOT replyer, by PM
-- Created by TTB, 17-10-05
-- Request from Leun
--------------------------------------------
 
bots = {
["[BOT]CBS"] = 1,
["[BOT]Predator"] = 1,
}
 
bot = "PMreport"
 
WhoAreTheOps = {
[-1] = 1,  -- Users
[0] = 1,   -- Masters
[1] = 0,   -- OPs
[2] = 0,   -- VIPs
[3] = 0,   -- REGs
[4] = 1,   -- MODs
[5] = 1,   -- Founders
}
 
function Main()
frmHub:RegBot(bot)
end
 
function OpSend(msg)
for i,v in frmHub:GetOnlineUsers() do
if WhoAreTheOps[v.iProfile] == 1 then
v:SendPM(bot,msg)
end
end
end
 
function ToArrival(curUser,data)
local _,_,whoTo,mes = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$(.*)")
if (bots[whoTo]==1 and string.find(mes,"%b<>%s+(.*)")) then
data = string.sub(mes,1,string.len(mes)-1)
curUser:SendPM(whoTo, "I'm a BOT! So that means I'm stupid and only configured by someone who is smarter than me. Please PM to PMtoOPs for your questions...")
OpSend("The user: "..curUser.sName.."  was trying to talk to me:  "..mes)
end
end
Title:
Post by: TTB on 17 October, 2005, 15:41:46
This should be the last script you load in PtokaX!! Otherwise you will have problems by your commands from your other bots!
Title: Why the last?
Post by: Markitos on 17 October, 2005, 15:54:22
QuoteOriginally posted by TTB
This should be the last script you load in PtokaX!! Otherwise you will have problems by your commands from your other bots!
Title: thnx TTB
Post by: Leun on 17 October, 2005, 16:20:36
good work, if tested it, and it works great !!!!!!!!

Thnx,
Title:
Post by: TTB on 17 October, 2005, 17:05:21
QuoteOriginally posted by Markitos
QuoteOriginally posted by TTB
This should be the last script you load in PtokaX!! Otherwise you will have problems by your commands from your other bots!

Because.... The script only just catches if there is a ToArrival to the bot(s). If there is, it will reply. But... let me explain it by example:

You run RoboCop. Type in PM to the bot !help. After this command, robocop will end this with a "return 1" which means, no other script can catch this when it is loaded AFTER robocop.

So, when the script is loaded before RoboCop, this script will catch it first, and after that the command will be catched by Robocop, even when the command exists!

I hope you understand...
Title:
Post by: Markitos on 17 October, 2005, 20:32:30
QuoteOriginally posted by TTB
QuoteOriginally posted by Markitos
QuoteOriginally posted by TTB
This should be the last script you load in PtokaX!! Otherwise you will have problems by your commands from your other bots!

Because.... The script only just catches if there is a ToArrival to the bot(s). If there is, it will reply. But... let me explain it by example:

You run RoboCop. Type in PM to the bot !help. After this command, robocop will end this with a "return 1" which means, no other script can catch this when it is loaded AFTER robocop.

So, when the script is loaded before RoboCop, this script will catch it first, and after that the command will be catched by Robocop, even when the command exists!

I hope you understand...
Yep thnks!