PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: Madman on 17 May, 2006, 16:49:26

Title: Chatty
Post by: Madman on 17 May, 2006, 16:49:26

-- Chatty
-- Made by Madman, 17.05.06
-- Extracted from FunScript 8.7
-- Done on request from Markitos

Bot = "Chatty"
Min = 10

function Main()
Elite,Camel,AscII = 0,0,0
end

function OnTimer()
StopTimer()
Elite,Camel,AscII = 0,0,0
SendToAll(Bot, "Talk modes has been deactivated")
end

function ChatArrival(curUser, data)
local data = string.sub(data, 1, -2)
local s,e,cmd = string.find(data, "%b<>%s+%p(%S+)")
if cmd then -- If we find a command
cmd = string.lower(cmd)
local tCmds = {
--== Mode talk Commands ==--
["elite"] = function(curUser, data)
if curUser.bOperator then
local s,e,switch = string.find(data, "%b<>%s+%S+%s+(%S+)")
if switch then
local tSwitch = {
["on"] = function(curUser, data)
if Elite == 1 then
curUser:SendData(Bot, "Elite talk is all ready on, you fool") return 1
end
Elite,Camel,AscII = 1,0,0
SetTimer(1000*60*Min) StartTimer()
SendToAll(Bot, curUser.sName.. " turn3d th3 3lit3 t4lk 0n") return 1
end,
["off"] = function(curUser, data)
if Elite == 0 then
curUser:SendData(Bot, "You can't stop something that allready is stoped") return 1
end
Elite,Camel,AscII = 0,0,0
SendToAll(Bot, curUser.sName.. " turned the elite talk off") return 1
end,
}
if tSwitch[switch] then
return tSwitch[switch](curUser, data)
else
curUser:SendData(Bot, "Syntax: !elite <on or off>") return 1
end
end
curUser:SendData(Bot, "Syntax: !elite <on or off>") return 1
end
end,
["camel"] = function(curUser, data)
if curUser.bOperator then
local s,e,switch = string.find(data, "%b<>%s+%S+%s+(%S+)")
if switch then
local tSwitch = {
["on"] = function(curUser, data)
if Camel == 1 then
curUser:SendData(Bot, "It's AlLrEaDy On") return 1
end
Elite,Camel,AscII = 0,1,0
SetTimer(1000*60*Min) StartTimer()
SendToAll(Bot, curUser.sName.. " has started the camel typeing... ;)") return 1
end,
["off"] = function(curUser, data)
if Camel == 0 then
curUser:SendData(Bot, "Camel is off, no need to turn it off then...") return 1
end
Elite,Camel,AscII = 0,0,0
SendToAll(Bot, curUser.sName.. " stoped the camle typeing") return 1
end,
}
if tSwitch[switch] then
return tSwitch[switch](curUser, data)
else
curUser:SendData(Bot, "Syntax: !camel <on or off>") return 1
end
end
curUser:SendData(Bot, "Syntax: !camel <on or off>") return 1
end
end,
["ascii"] = function(curUser, data)
if curUser.bOperator then
local s,e,switch = string.find(data, "%b<>%s+%S+%s+(%S+)")
if switch then
local tSwitch = {
["on"] = function(curUser, data)
if AscII == 1 then
curUser:SendData(Bot, "AscII is allready on") return 1
end
Elite,Camel,AscII = 0,0,1
SetTimer(1000*60*Min) StartTimer()
SendToAll(Bot, "AscII talk enabled by " ..curUser.sName) return 1
end,
["off"] = function(curUser, data)
if AscII == 0 then
curUser:SendData(Bot, "AscII is off") return 1
end
Elite,Camel,AscII = 0,0,0
SendToAll(Bot, curUser.sName.. " returned the normal letter's") return 1
end,
}
if tSwitch[switch] then
return tSwitch[switch](curUser, data)
else
curUser:SendData(Bot, "Syntax: !ascii <on or off>") return 1
end
end
curUser:SendData(Bot, "Syntax: !ascii <on or off>") return 1
end
end,
}
if tCmds[cmd] then
return tCmds[cmd](curUser, data)
end
else
if Camel == 1 then
s,e,msg = string.find(data,"%b<>%s(.+)")
CamelTalk(curUser) return 1
end
if AscII == 1 or Elite == 1 then
if AscII == 1 then Table = tAscII
elseif Elite == 1 then Table = tElite
end
TalkMode(curUser, Table, data) return 1
end
end
end

function OpConnected(curUser, data)
if curUser.bUserCommand then
curUser:SendData("$UserCommand 1 3 Chatty\\Set elite talk on$<%[mynick]> !elite on&#124;")
curUser:SendData("$UserCommand 1 3 Chatty\\Set elite talk off$<%[mynick]> !elite off&#124;")
curUser:SendData("$UserCommand 1 3 Chatty\\CaMeL tAlK On$<%[mynick]> !camel on&#124;")
curUser:SendData("$UserCommand 1 3 Chatty\\Camel talk off$<%[mynick]> !camel off&#124;")
curUser:SendData("$UserCommand 1 3 Chatty\\AscII talk on$<%[mynick]> !ascii on&#124;")
curUser:SendData("$UserCommand 1 3 Chatty\\AscII talk off$<%[mynick]> !ascii off&#124;")
end
end

function TalkMode(curUser, table, data)
local s,e,msg = string.find(data, "%b<>%s(.+)")
local msg = string.gsub(msg, "(.)", function(letter) return Replace(letter, table) end)
SendToAll(curUser.sName, msg)
end

function CamelTalk(curUser)
count = string.len(msg)
local lines = {}
local line = ""
if updown == nil then
updown = 0
end
for i=1,(count) do
msg2 = string.sub(msg, -1, (string.len(msg)))
if string.len(msg) == 1 then
table.insert(lines, msg)
else
table.insert(lines, msg2)
msg = string.sub(msg, 1, (string.len(msg)-1))
end
end
for i=1,(count) do
if updown == 0 then
lines[i] = string.upper(lines[i])
updown = 1
else
lines[i] = string.lower(lines[i])
updown =0
end
line = lines[i]..line
end
SendToAll(curUser.sName, line) return 1
end

function Replace(letter, table, b)
if table[letter] then
letter = table[letter]
end
return letter..(b or "")
end

tAscII = {
["a"] = "?",["b"] = "?",["c"] = "?",["d"] = "?", ["e"] = "?",["f"] = "ƒ",["g"] = "g",["h"] = "h",["i"] = "?",["j"] = "j", ["k"] = "k",["l"] = "l",["m"] = "m",["n"] = "?",["o"] = "?",["p"] = "?", ["q"] = "q",["r"] = "r",["s"] = "?",["t"] = "†",["u"] = "?",["v"] = "v", ["w"] = "w",["x"] = "?",["y"] = "?",["z"] = "z",
["A"] = "?",["B"] = "?", ["C"] = "?",["D"] = "?",["E"] = "?",["F"] = "F",["G"] = "G",["H"] = "]-[", ["I"] = "?",["J"] = "J",["K"] = "K",["L"] = "L",["M"] = "M",["N"] = "N", ["O"] = "?",["P"] = "P",["Q"] = "Q",["R"] = "R",["S"] = "?",["T"] = "T", ["U"] = "?",["V"] = "V",["W"] = "W",["X"] = "X",["Y"] = "?",["Z"] = "Z",
}

tElite = { ["A"] = "4", ["a"] = "4", ["B"] = "8", ["b"] = "8", ["E"] = "3", ["e"] = "3", ["G"] = "6", ["g"] = "9", ["I"] = "1", ["i"] = "1", ["L"] = "1", ["l"] = "1", ["O"] = "0", ["o"] = "0", ["S"] = "5", ["s"] = "5", ["T"] = "7", ["t"] = "7",? ["z"] = "2", ["Z"] = "2" }
Title: Re: Chatty
Post by: Markitos on 18 May, 2006, 09:22:58
Thanks  :D