PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: NemeziS on 15 September, 2004, 21:01:27

Title: Bot answers on userinfo
Post by: NemeziS on 15 September, 2004, 21:01:27
Hi,

I wanted a script for:

Example:

somebody writes !userinfo  (or !whois) Botname
he will not get userinfo (botinfo), he will get an answer in main

[22:56:18] you can't do this ;)

or

[22:56:18] don't do this ;)

or etc.

I wanted this bot working like trickerbot.
It must answer to user in random mode if user wants to get bot's info on !userinfo . It must be nearly 6 bot answers (or more) in the script (I can change and edit them).

Do you understand me? =))
Title:
Post by: nErBoS on 16 September, 2004, 00:12:16
Hi,

Hope it helps...

--## Bot Revange
--## Requested by NemeziS
--## Will respond random to a comand used for Bot
--## Made by nErBoS

sBot = "R-Bot"

arrCMD = {
["!userinfo"] = {
"MSG1",
"MSG2",
},
["!whois"] = {
"MSG1",
"MSG2",
},
}

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,strlen(data)-1) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (arrCMD[cmd] ~= nil) then
local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
if (strlower(nick) == strlower(sBot)) then
user:SendData(sBot, arrCMD[cmd][random(1,getn(arrCMD[cmd]))])
return 1
end
end
end
end

Best regards, nErBoS
Title:
Post by: NemeziS on 16 September, 2004, 10:42:12
Thanx! It works! 10x! :))