this is a small script i made to notify all users in the mainchat when the topic changes. it also allows an op to type !topic instead of !topic off to clear the topic.
-- Topic Notifier v1.0
-- by Fangs404
-- last modified 4/26/05
-- tested with PtokaX 0.3.3.0 build 17.03
sBot = frmHub:GetHubBotName()
function ChatArrival(user, sData)
local sCmd = isCmd(sData)
if (not user.bOperator) or (not sCmd) then
return
end
local s,e,sTopic,sMsg = string.find(sData, "^%b<>%s"..sCmd.."(%S+)%s*(.*)")
if sTopic == "topic" or sTopic == "topic|" then
if frmHub:GetHubTopic() == nil and (string.len(sMsg) == 0 or sMsg == "off|") then
return 1
end
if string.len(sMsg) == 0 or sMsg == "off|" then
SendToAll(sBot, "*** The topic was deleted by "..user.sName..".")
frmHub:SetHubTopic('')
else
SendToAll(sBot, "*** The topic was changed by "..user.sName.." to: "..sMsg)
frmHub:SetHubTopic(sMsg)
end
return 1
end
end
function isCmd(sData)
local s,e,prefix = string.find(sData, "^%b<>%s([!+/])%S+")
return prefix
end
i'm totally welcome to suggestions and improvements. enjoy!
Hi m8 ...
Quotei'm totally welcome to suggestions and improvements. enjoy!
would be a nice feature to Add multi line topic Changed on timer..
Many ppl have asked me to Strip it out of XN as Stand alone BUt it will be good to see you Expanding this script.
one line from XN
frmHub:SetHubTopic(topic5.." - Hub Local Time : "..os.date("%H:%M").." Hub Addy:- ")
adds time to topic aswell ...
Keep it up m8 ...
HAVE FUN
??????Hawk??????
QuoteOriginally posted by ??????Hawk??????
Hi m8 ...
Quotei'm totally welcome to suggestions and improvements. enjoy!
would be a nice feature to Add multi line topic Changed on timer..
Many ppl have asked me to Strip it out of XN as Stand alone BUt it will be good to see you Expanding this script.
one line from XN
frmHub:SetHubTopic(topic5.." - Hub Local Time : "..os.date("%H:%M").." Hub Addy:- ")
adds time to topic aswell ...
Keep it up m8 ...
HAVE FUN
??????Hawk??????
what exactly do you mean about multi-line topic changer? thanks for the suggestions. :) right now, i'm trying to figure out a way to use frmHub:GetPrefixes() instead of hardcoding them in. it'd be more user-friendly that way. i'll post the code when i get that done.
QuoteOriginally posted by Fangs404
what exactly do you mean about multi-line topic changer? thanks for the suggestions. :)
What he means is that you use a Timer and change the Topic evey X min =)
QuoteOriginally posted by madman
QuoteOriginally posted by Fangs404
what exactly do you mean about multi-line topic changer? thanks for the suggestions. :)
What he means is that you use a Timer and change the Topic evey X min =)
ohhh, that's kinda cool. i may do that. first, i've got to figure out this GetPrefixes thing.
i cleaned up the code a ton. also, i added functionality for the GetPrefixes() command, so the prefixes no longer have to be entered into the script manually - just change the available prefixes from within ptokax. if you change the prefixes while the script is running, you'll have to reload the script.
-- Topic Notifier v1.1
-- by Fangs404
-- last modified 4/27/05
-- tested with PtokaX 0.3.3.0 build 17.03
sBot = frmHub:GetHubBotName()
tPrefixes = frmHub:GetPrefixes()
function ChatArrival(user, sData)
local s,e,sCmd,sMsg = string.find(sData, "^%b<>%s*(%S+)%s*(.*)|")
if (not user.bOperator) or (not isTopicCmd(sCmd)) then
return
end
if string.len(sMsg) == 0 or sMsg == "off" then
SendToAll(sBot, "*** The topic was deleted by "..user.sName..".")
frmHub:SetHubTopic('')
else
SendToAll(sBot, "*** The topic was changed by "..user.sName.." to: "..sMsg)
frmHub:SetHubTopic(sMsg)
end
return 1
end
function isTopicCmd(sCmd)
for index in tPrefixes do
if sCmd == (tPrefixes[index].."topic") then
return 1
end
end
return
end
fixed some stuff up and rearranged the code.
-- Topic Notifier v1.2
-- by Fangs404
-- last modified 4/27/05
-- tested with PtokaX 0.3.3.0 build 17.03
sBot = frmHub:GetHubBotName()
tPrefixes = frmHub:GetPrefixes()
function ChatArrival(user, sData)
local s,e,sCmd,sMsg = string.find(sData, "^%b<>%s*(%S+)%s*(.*)|")
if (not user.bOperator) or (not isTopicCmd(sCmd)) then
return
end
changeTopic(user, sMsg)
return 1
end
function changeTopic(user, sMsg)
if string.len(sMsg) == 0 or sMsg == "off" then
SendToAll(sBot, "*** The topic was deleted by "..user.sName..".")
frmHub:SetHubTopic('')
else
SendToAll(sBot, "*** The topic was changed by "..user.sName.." to: "..sMsg)
frmHub:SetHubTopic(sMsg)
end
end
function isTopicCmd(sCmd)
for index in tPrefixes do
if sCmd == (tPrefixes[index].."topic") then
return 1
end
end
return
end
yay for more generic code. :)
-- Topic Notifier v1.3
-- by Fangs404
-- last modified 4/28/05
-- tested with PtokaX 0.3.3.0 build 17.03
sBot = frmHub:GetHubBotName()
tPrefixes = frmHub:GetPrefixes()
function ChatArrival(user, sData)
local s,e,sCmd,sMsg = string.find(sData, "^%b<>%s*(%S+)%s*(.*)|")
if (not user.bOperator) or (not isValidCmd(sCmd, "topic")) then
return
end
changeTopic(user, sMsg)
return 1
end
function changeTopic(user, sMsg)
if string.len(sMsg) == 0 or sMsg == "off" then
SendToAll(sBot, "*** The topic was deleted by "..user.sName..".")
frmHub:SetHubTopic('')
else
SendToAll(sBot, "*** The topic was changed by "..user.sName.." to: "..sMsg)
frmHub:SetHubTopic(sMsg)
end
end
function isValidCmd(sCurCmd, sNeedCmd)
for index in tPrefixes do
if sCurCmd == (tPrefixes[index]..sNeedCmd) then
return 1
end
end
return
end
condensed a whole lot more and using my generic isValidCmd function.
-- Topic Notifier v1.5
-- by Fangs404
-- last modified 4/28/05
-- tested with PtokaX 0.3.3.0 build 17.03
sBot = frmHub:GetHubBotName()
tPrefixes = frmHub:GetPrefixes()
function ChatArrival(user, sData)
local s,e,sCmd,sMsg = string.find(sData, "^%b<>%s*(%S*)%s*(.*)|")
if user.bOperator and isValidCmd(sCmd, "topic") then
if sMsg == "" or sMsg == "off" then
frmHub:SetHubTopic('')
SendToAll(sBot, "*** The topic was deleted by "..user.sName..".")
else
frmHub:SetHubTopic(sMsg)
SendToAll(sBot, "*** The topic was changed by "..user.sName.." to: "..sMsg)
end
return 1
end
end
function isValidCmd(sCurCmd, sNeedCmd)
for index in tPrefixes do
if sCurCmd == (tPrefixes[index]..sNeedCmd) then
return 1
end
end
end
Fangs404 can you make the script to change the topic automatical ? exemple :
"Bla bla bla bla"
waiting 10 min
an apears another one "boom boom boom"
waiting 10 min apears another one "la la la la"
aaa ?? cand you make it ? ?(
i hope you understand meeeee :(
@ GodLike ,
The -- Chatterbot 1.2 [Mod from Mutors Random chatter] , change the topic automatical ...from 1 min to 60 min Interval...Search this hier in forum :))
MfG
James
-- Chatterbot 1.2 [Mod from Mutors Random chatter]
Bot = "BOT" -- Name for bot --
cMenu = "Zright" -- RightClick menu name --
Where = 2 -- Where you want messages go 2=topic 1=main 0=box under chat
Mins = 0.3 -- Interval [in minutes] between messages
CommOn = "!advon" -- Command for Start the script
CommOff = "!advoff" -- Command for Stop the script
StartOn = "1" -- Start script on start 1=on 0=off
SendComm = 0 -- RightClick commands on/off 1=on 0=off
Version = "1.2"
SetTo = {
[0] = 1, -- Masters -- Give right click commands 1=yes 0=no
[1] = 1, -- Operators -- Give right click commands 1=yes 0=no
[4] = 1, -- Moderator -- Give right click commands 1=yes 0=no
[5] = 1, -- NetFounder -- Give right click commands 1=yes 0=no
}
local tmp = os.clock()
local days, hours, minutes = math.floor(tmp/86400), math.floor(math.mod(tmp/3600, 24)), math.floor(math.mod(tmp/60, 60))
--NEWS*****NEWS*****NEWS*****NEWS*****NEWS*****NEWS*****NEWS*****NEWS--
Lines = {
"text1",
"text2",
"text3",
"text4",
}
function NewUserConnected(user)
SendToAll(MyInfoString)
if SendComm == 1 and SetTo[user.iProfile] == 1 then
user:SendData("$UserCommand 1 3 "..cMenu.."\\?~Chatter bot v"..Version.."~?$<%[mynick]> "..CommOn.."||")
user:SendData("$UserCommand 1 3 "..cMenu.."\\Turn chatter on$<%[mynick]> "..CommOn.."||")
user:SendData("$UserCommand 1 3 "..cMenu.."\\Turn chatter off$<%[mynick]> "..CommOff.."||")
user:SendData("$UserCommand 1 3 "..cMenu.."\\Bot version$<%[mynick]> !cvers||")
end
end
OpConnected = NewUserConnected
function Main()
SetTimer(Mins*60000)
if StartOn == "1" then
StartTimer()
end
end
function ChatArrival(user, data)
s,e,cmd = string.find(data, "%b<>%s+(%S+)(%S+)")
if (cmd==CommOn) and user.bOperator then
user:SendData(Bot," Started ?? Messages will be shown in every "..Mins.." minute/s. Type '"..CommOff.."' to stop me.")
StartTimer()
return 1
elseif (cmd==CommOff) and user.bOperator then
StopTimer()
user:SendData(Bot," Stopped ?? Type "..CommOn.." to start me again.")
return 1
elseif (cmd=="!cvers") and user.bOperator then
user:SendData(Bot,"hello i am ChatterBot v: "..Version.." made by C??o?y??")
return 1
end
end
function OnTimer()
local RandomChat = Lines[math.random(1, table.getn(Lines))]
if Where==1 then
SendToAll(Bot,"\n\r\n\t"..RandomChat.."\r\n")
elseif Where==2 then
frmHub:SetHubTopic(RandomChat)
elseif Where==0 then
SendToAll("\t"..RandomChat.."\t\t\t\t\t\t\t\t\t\t\t is kicking because:")
end
end
where i get him James ? :(
Thx James :)
Maby this is all you need...
-------------------------------------------------------------------------
-----Topic Changer LUA 5 by ??????Hawk??????
-------------------------------------------------------------------------
tTopic = {
[1] = " Topic 1 text", --// Set your topics 1 to 6 here
[2] = " Topic 2 text",
[3] = " Topic 3 text",
[4] = " Topic 4 text",
[5] = " Topic 5 text",
[6] = " Topic 6 text",
["counter"] = 0,
["timer"] = 1000 * 60 * 1, --// Timer set to 1 min
["SendTopic"] = function()
tTopic["counter"] = tTopic["counter"] + 1
frmHub:SetHubTopic(tTopic[tTopic["counter"]])
if tTopic["counter"] == 6 then
tTopic["counter"] = 0
end
end,
}
function Main()
SetTimer(tTopic["timer"])
StartTimer()
end
function OnTimer()
tTopic["SendTopic"]()
end
Yes...only for Topic is the Script from Hawk beter.
The Chatter from Mutor is for Topic ,MainChat or The Box under The MainChat. :))
This is what i need THANX !!!!!
hmmm. topic i change automatical in 1 minute where i modify to 20 min ?
please
Mins = 0.3 -- Interval [in minutes] between messages
change to
Mins = 20 -- Interval [in minutes] between messages
This is the Time (interval in Min...20 = 20 Min)
MfG
James
please modify you the script ! :( ! i dont know !
please modify you the script :(
! i don`t know ! ;(
please modify you the script for meeee ;(
-- Chatterbot 1.2 [Mod from Mutors Random chatter]
Bot = "BOT" -- Name for bot --
cMenu = "Zright" -- RightClick menu name --
Where = 2 -- Where you want messages go 2=topic 1=main 0=box under chat
Mins = 20 -- Interval [in minutes] between messages
CommOn = "!advon" -- Command for Start the script
CommOff = "!advoff" -- Command for Stop the script
StartOn = "1" -- Start script on start 1=on 0=off
SendComm = 0 -- RightClick commands on/off 1=on 0=off
Version = "1.2"
SetTo = {
[0] = 1, -- Masters -- Give right click commands 1=yes 0=no
[1] = 1, -- Operators -- Give right click commands 1=yes 0=no
[4] = 1, -- Moderator -- Give right click commands 1=yes 0=no
[5] = 1, -- NetFounder -- Give right click commands 1=yes 0=no
}
local tmp = os.clock()
local days, hours, minutes = math.floor(tmp/86400), math.floor(math.mod(tmp/3600, 24)), math.floor(math.mod(tmp/60, 60))
--NEWS*****NEWS*****NEWS*****NEWS*****NEWS*****NEWS*****NEWS*****NEWS--
Lines = {
"text1",
"text2",
"text3",
"text4",
}
function NewUserConnected(user)
SendToAll(MyInfoString)
if SendComm == 1 and SetTo[user.iProfile] == 1 then
user:SendData("$UserCommand 1 3 "..cMenu.."\\?~Chatter bot v"..Version.."~?$<%[mynick]> "..CommOn.."||")
user:SendData("$UserCommand 1 3 "..cMenu.."\\Turn chatter on$<%[mynick]> "..CommOn.."||")
user:SendData("$UserCommand 1 3 "..cMenu.."\\Turn chatter off$<%[mynick]> "..CommOff.."||")
user:SendData("$UserCommand 1 3 "..cMenu.."\\Bot version$<%[mynick]> !cvers||")
end
end
OpConnected = NewUserConnected
function Main()
SetTimer(Mins*60000)
if StartOn == "1" then
StartTimer()
end
end
function ChatArrival(user, data)
s,e,cmd = string.find(data, "%b<>%s+(%S+)(%S+)")
if (cmd==CommOn) and user.bOperator then
user:SendData(Bot," Started ?? Messages will be shown in every "..Mins.." minute/s. Type '"..CommOff.."' to stop me.")
StartTimer()
return 1
elseif (cmd==CommOff) and user.bOperator then
StopTimer()
user:SendData(Bot," Stopped ?? Type "..CommOn.." to start me again.")
return 1
elseif (cmd=="!cvers") and user.bOperator then
user:SendData(Bot,"hello i am ChatterBot v: "..Version.." made by C??o?y??")
return 1
end
end
function OnTimer()
local RandomChat = Lines[math.random(1, table.getn(Lines))]
if Where==1 then
SendToAll(Bot,"\n\r\n\t"..RandomChat.."\r\n")
elseif Where==2 then
frmHub:SetHubTopic(RandomChat)
elseif Where==0 then
SendToAll("\t"..RandomChat.."\t\t\t\t\t\t\t\t\t\t\t is kicking because:")
end
end
sorry for delay been busy
Script edited
Just change the 1 in this line for the ammount of mins
["timer"] = 1000 * 60 * 1, --// Timer set to
??????Hawk??????