I found this multiple timer scripts on this forum, but when I altered it, the second timer doesn't work.
This is my code:
QuoteBot = "Your mama"
Prefix = "+"
Version = "0.2"
Sec = 1000
Min = 60*Sec
Hour = 60*Min
Day = 24*Hour
TmrFreq = 1*Sec
tabTimers = {n=0}
trigall = 1
trigs = {
["lol"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["hehe"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["haha"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["rofl"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["lmao"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["bye"]={
"See ya, [USER]",
"Bye, [USER] .....*sniff*",
"Hey [USER]! Get your ass back here. Hehe just kidding, if you have to go, you have to go. Bye",
"*Sniff* We will miss you, [USER]!",
"*Waves bye*",
"Leaving already?!",
"Got better things to do, huh?",
"Go on...leave!"
},
["cya"]={
"See ya, [USER]",
"Bye, [USER] .....*sniff*",
"Hey [USER]! Get your ass back here. Hehe just kidding, if you have to go, you have to go. Bye",
"*Sniff* We will miss you, [USER]!",
"*Waves bye*",
"Leaving already?!",
"Got better things to do, huh?",
"Go on...leave!"
},
["cu"]={
"See ya, [USER]",
"Bye, [USER] .....*sniff*",
"Hey [USER]! Get your ass back here. Hehe just kidding, if you have to go, you have to go. Bye",
"*Sniff* We will miss you, [USER]!",
"*Waves bye*",
"Leaving already?!",
"Got better things to do, huh?",
"Go on...leave!"
},
["fuck"]={
"Watch it [CUSER]!! One more line of code and I could kick your ass!",
"I hate it when you talk like that!",
"Don't ever insult me again",
"That's not a very nice way to talk !",
"Keep it up and I will kick you!",
"Say that again and I am going to clobber you!"
},
["fucker"]={
"Watch it [CUSER]!! One more line of code and I could kick your ass!",
"I hate it when you talk like that!",
"Don't ever insult me again",
"That's not a very nice way to talk !",
"Keep it up and I will kick you!",
"Say that again and I am going to clobber you!"
},
["shut up"]={
"Make me!",
"Ooh! I'm wounded!",
"I'll shut up when I damn well please",
"Blah blah blah!",
"Why should I?"
},
["stfu"]={
"Make me!",
"Ooh! I'm wounded!",
"I'll shut up when I damn well please",
"Blah blah blah!",
"Why should I?"
},
["hi"]={
"Hello [USER]",
"Hey [USER]",
"Wassup [USER]",
"Hi [USER]",
"Hey [USER], What's going on?",
"Howdy [USER]!",
"Greetings, [USER]",
"[USER], Do I know you?"
},
["hello"]={
"Hello [USER]",
"Hey [USER]",
"Wassup [USER]",
"Hi [USER]",
"Hey [USER], What's going on?",
"Howdy [USER]!",
"Greetings, [USER]",
"[USER], Do I know you?"
},
["hey"]={
"Hello [USER]",
"Hey [USER]",
"Wassup [USER]",
"Hi [USER]",
"Hey [USER], What's going on?",
"Howdy [USER]!",
"Greetings, [USER]",
"[USER], Do I know you?"
},
["drunk"]={
"me dRunk? *HICK*",
"pftftt paff the boffle bartender pfffttttttt",
"I just drank a little...",
"I am not drunk!!",
"I am not dddddddddddddrunk.....",
"Drunk?",
"Pfftt!",
"Pour me another",
"*Spew*",
"Oohhh my head",
"I think I'm gonna hurl",
"*BLAH*",
"*BURP*",
"Me not drunk *HICK*"
},
["bot"]={
"A bot?",
"Me? I don't think so...",
"Don't lie!",
"Piece of shit! I 've been detected! -NOT-",
"I am quite human...",
"Bite me!",
"Eat shit! I am not a bot!",
"A bot?",
"What the shit is a bot?",
"You don't think my name is 'Bot' do you?",
"Are you trying to say that I am a machine?",
"ME? HAHA",
"I am a real person!",
"I am not a bot, I am a real human!",
"I may be dumb, but I am not a bot!",
"I may be really confused, but I am no robot!",
"I assure you I am just as real as you!",
"I know you are, but what am I?",
"I'm not!",
"<- - - real live person",
"Kill the bots!",
"Who is a bot???",
"A bot? Where?",
"A bot? Here?",
"I doubt if there are any bots here!",
"Where do you get such a crazy idea!",
"I am NOT a bot",
"I am all too real, sorry!",
"I am a fleshy human being!",
"Do you make it a habit of accusing others, [USER]?"
},
["drug"]={
"Drugz?",
"Illegal substances?",
"Narcotics?",
"Sniiiiiifffffff",
"Me drugs? Never!",
"Who is selling drugs?",
"Aren't drugs legal in Amsterdam?",
"Drugs are too expensive",
"Drugs are too dangerous",
"Drugs inhibit my abily ot tiiiippe.",
"Purple haze, all around my brain...",
"Go to drugs R us",
"Drugs are bad",
"Just say no!",
"Just say maybe!",
"Just say how much!",
"I buy my crack from the mexicans!",
"I hear that the telephone company is a big doper!",
"I think all the drugs are smuggled in from the planet 'Uranus'",
"Whehhwewe! Pretty elephants!",
"*SNIFF* Ahh!"
},
["drink"]={
"Gulp, gulp, gulp",
"*Takes big drink*",
"Bartender! Pour me another!",
"Hick!",
"I am thirsty...",
"Pass the bottle",
"*Takes a shot*",
"I need another cool one",
"This bud's for me! *GULP*",
"I can drink 16 six packs!",
"Aye... I'll drink any man under the table!",
"*REACHES FOR THE BOTTLE*",
"*BURP*",
"I need some more Budweiser",
"Somebody pour me a big glass of Guinness Stout.",
"Anyone ever try a wild turkey?",
"I love beer!",
"I love vodka!",
"I took 14 shots of mad dog once!",
"Itth myth speetthch slurrererrred????",
"I think alll mi beer is iampring mi typppin abillty?!?",
"Someone get me a beer!",
"Beer is awesome!",
"Humans can not live by beer alone! But I'd like to try!",
"I think you should stop drinking"
},
["sorry"]={
"Don't worry about it",
"That's ok ",
"Ok",
"That's allright",
"Fine",
"As long as your sorry...",
"Allright",
"I feel you didn't really mean that...",
"You don't sound sincere",
"Are you really sorry?",
"Forget it",
"No sweat",
"Ok"
},
["wassup"]={
"Hunting crocodiles",
"Nothing at the moment",
"Eating",
"Eating pizza",
"Changing the tires on my dodge",
"Juggling chainsaws",
"Drinking beer",
"Smoking up a storm",
"Belly-dancing",
"Hacking microsoft.com",
"Trying to keep awake!",
"Watching television",
"I am doing homework",
"What do you think!",
"Building a spice rack",
"Taking a shower",
"Drinking myself to death",
"Drinking myself to oblivian",
"Making origami swans",
"Feeding my ducks",
"Learning latin",
"Programming",
"Play the basoon",
"Program in Assembly",
"Program in C++"
},
["are you"]={
"Does it matter if I am ?",
"What difference does it make whether or not I am",
"Of course not, don't be silly",
"Whether I'm or not is my secret",
"Why do you want to know?",
"Why are you so nosy?",
"Perhaps I am ",
"None of your business",
"I think you are ",
"Does it matter if I am or not?",
"Why do you ask?",
"I might be",
"No, I am not ",
"Of course",
"Never have been",
"Why, are you?"
},
["bitch"]={
"Who are you calling a bitch??",
"Oh, I'm upset",
"I can be a bitch!",
"Hey [USER], that is no way to talk!",
"Do you think foul language impresses me?",
"A bitch is a female dog"
},
["yeah"]={
"Yes",
"Yep",
"100%",
"Bang on!",
"You bet",
"Uh-hu",
"Of course!",
"You betcha",
"Affirmative",
"10-4 good buddy!",
"Correct",
"Yeah",
"That's right!",
"You got it!",
"Sure",
"Precisely right",
"That sounds right",
"Exactly!",
"You know it!",
"Yeppers"
},
["HiddenSniper"]={
"HiddenSniper hates me! What did I do wrong? :(",
"I think HiddenSniper is a nice person, well sometimes anyways....",
"HiddenSniper is a bitch to me all the time, and I dunno why!",
"Hey HiddenSniper, Wanna snuggle? *winks*"
}
}
function Main()
frmHub:RegBot(Bot)
RegTimer(tmrone, 1*Sec)
RegTimer(tmrtwo, 1*Sec)
SetTimer(TmrFreq)
StartTimer()
end
function NewUserConnected(user)
SendToAll(Bot,"Welcome our new guest "..user.sName..", enjoy your stay")
end
function OpConnected(user)
Connect = random(5)
if Connect == 1 then
SendToAll(Bot,user.sName.." has entered the hub")
elseif Connect == 2 then
SendToAll(Bot,user.sName.." has entered, feel his wrath")
elseif Connect == 3 then
SendToAll(Bot,user.sName.." is one of the big bosses, who just entered")
elseif Connect == 4 then
SendToAll(Bot,user.sName.." has sneaked into the hub")
elseif Connect == 5 then
SendToAll(Bot,user.sName.." has just kicked down the door")
end
end
function deathfunction(user)
dead = random(5)
if dead == 1 then
SendToAll(Bot,user.sName.." has killed their self, and fell out the hub")
elseif dead == 2 then
SendToAll(Bot,user.sName.." has killed their self, what a pillock")
elseif dead == 3 then
SendToAll(Bot,user.sName.." is a total nutter, they killed em'self")
elseif dead == 4 then
SendToAll(Bot,user.sName.." is now dead, falling from the hub")
elseif dead == 5 then
SendToAll(Bot,user.sName.." jumps a mile high with a rope around their nech and drops down a hole, thats the last we seen of em")
end
user:Disconnect()
end
function OnTimer()
for i=1, getn(tabTimers) do
tabTimers.count = tabTimers.count + 1
if tabTimers.count > tabTimers.trig then
tabTimers.count=1
tabTimers:func()
end
end
end
function RegTimer(f, Interval)
local tmpTrig = Interval / TmrFreq
assert(Interval >= TmrFreq , "RegTimer(): Please Adjust TmrFreq")
local Timer = {n=0}
Timer.func=f
Timer.trig=tmpTrig
Timer.count=1
tinsert(tabTimers, Timer)
end
function tmrone()
SendToAll(Bot, answer)
StopTimer()
end
function tmrtwo()
SendToAll(Bot, "<<<<<<<<<<>>>>>>>>>>")
SendToAll(Bot, "<<<<<<<>>>>>>>")
SendToAll(Bot, "<<<<<<<<<<>>>>>>>>>>")
end
function DataArrival(user, data)
status=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind( status, "%b<>%s+(%S+)" )
if (cmd == Prefix.."shh") then
trigall=0
SendToAll(Bot, " Hmf, Okay I will be quiet")
return 1
elseif (cmd == Prefix.."talk") then
trigall=1
SendToAll(Bot, " Okay, I will talk to you again")
return 1
end
if cmd == Prefix.."version" then
user:SendData(Bot,"This is version: "..version)
return 1
end
if (cmd == Prefix.."mass") then
if user.bOperator then
s,e,cmd,message = strfind(data,"%s+(%S+)%s+(.*)")
if user == nil then
user:SendData(Bot,"The user isn't in the hub")
return 1
elseif message == nil then
user:SendData(Bot,"Please enter a message to mass")
return 1
end
user:SendPM(Bot," "..user.sName..": "..message)
end
end
if (cmd == Prefix.."death") then
deathfunction(user)
end
if( strsub(data, 1, 1) == "<" ) then
s,e,msg = strfind(data, "%b<>([%a ]+)")
if trigall==1 then
for key, value in trigs do
for key2, value2 in value do
if( strfind( strlower(msg), key) ) then
else break
end
if( strfind( strlower(msg), "!me") ) then
t="**"..user.sName
data=gsub (msg, "!me", t, 1 )
end
SendToAll( data )
SetTimer(Sec)
StartTimer()
answer, x = gsub(value[random(1,getn(value))], "%b[]", user.sName)
return 1
end
end
end
end
end
There wasn't room for this text:
Also I get a
Quote"RegTimer(): Please Adjust TmrFreq")
problem sometimes, why?
I want the timer2 to send a message every hour and timer1 to respond to keywords in 1 second.
QuoteOriginally posted by HiddenSniper
There wasn't room for this text:
Also I get a Quote"RegTimer(): Please Adjust TmrFreq")
problem sometimes, why?
I want the timer2 to send a message every hour and timer1 to respond to keywords in 1 second.
this bot cant use the timer like that as it need the first timer, and it stops thetimer on first timer lol
so what do I need to write to get 2 working timers?
change:
TmrFreq = 1*Sec
to
TmrFreq = 1000
and then in Main()
function Main()
frmHub:RegBot(Bot)
RegTimer(tmrone, 1*Sec)
RegTimer(tmrtwo, 1*Sec)
SetTimer(TmrFreq)
StartTimer()
end
this should solve your problem.
/NL
that gives timer1 and timer2 when keywords is pressed.
I only need timer1 to respond to keyword 1, timer2 should only send a message every hour.
ok this one should be as you want it as I recall you.
Bot = "Your mama"
Prefix = "+"
Version = "0.2"
Sec = 1000
Min = 60*Sec
Hour = 60*Min
Day = 24*Hour
TmrFreq = 1000
tabTimers = {n=0}
trigall = 1
trigs = {
["lol"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["hehe"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["haha"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["rofl"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["lmao"]={
"Yeah, [USER] that was funny, hahahaha.",
"Hmm, ok that was funny, I think",
"What! Why are you laughing [USER]?",
"You shake when you laugh, like a bowl full of jelly",
"Hilarious!",
"Hehehehe",
"Hohohoho",
},
["bye"]={
"See ya, [USER]",
"Bye, [USER] .....*sniff*",
"Hey [USER]! Get your ass back here. Hehe just kidding, if you have to go, you have to go. Bye",
"*Sniff* We will miss you, [USER]!",
"*Waves bye*",
"Leaving already?!",
"Got better things to do, huh?",
"Go on...leave!"
},
["cya"]={
"See ya, [USER]",
"Bye, [USER] .....*sniff*",
"Hey [USER]! Get your ass back here. Hehe just kidding, if you have to go, you have to go. Bye",
"*Sniff* We will miss you, [USER]!",
"*Waves bye*",
"Leaving already?!",
"Got better things to do, huh?",
"Go on...leave!"
},
["cu"]={
"See ya, [USER]",
"Bye, [USER] .....*sniff*",
"Hey [USER]! Get your ass back here. Hehe just kidding, if you have to go, you have to go. Bye",
"*Sniff* We will miss you, [USER]!",
"*Waves bye*",
"Leaving already?!",
"Got better things to do, huh?",
"Go on...leave!"
},
["fuck"]={
"Watch it [CUSER]!! One more line of code and I could kick your ass!",
"I hate it when you talk like that!",
"Don't ever insult me again",
"That's not a very nice way to talk !",
"Keep it up and I will kick you!",
"Say that again and I am going to clobber you!"
},
["fucker"]={
"Watch it [CUSER]!! One more line of code and I could kick your ass!",
"I hate it when you talk like that!",
"Don't ever insult me again",
"That's not a very nice way to talk !",
"Keep it up and I will kick you!",
"Say that again and I am going to clobber you!"
},
["shut up"]={
"Make me!",
"Ooh! I'm wounded!",
"I'll shut up when I damn well please",
"Blah blah blah!",
"Why should I?"
},
["stfu"]={
"Make me!",
"Ooh! I'm wounded!",
"I'll shut up when I damn well please",
"Blah blah blah!",
"Why should I?"
},
["hi"]={
"Hello [USER]",
"Hey [USER]",
"Wassup [USER]",
"Hi [USER]",
"Hey [USER], What's going on?",
"Howdy [USER]!",
"Greetings, [USER]",
"[USER], Do I know you?"
},
["hello"]={
"Hello [USER]",
"Hey [USER]",
"Wassup [USER]",
"Hi [USER]",
"Hey [USER], What's going on?",
"Howdy [USER]!",
"Greetings, [USER]",
"[USER], Do I know you?"
},
["hey"]={
"Hello [USER]",
"Hey [USER]",
"Wassup [USER]",
"Hi [USER]",
"Hey [USER], What's going on?",
"Howdy [USER]!",
"Greetings, [USER]",
"[USER], Do I know you?"
},
["drunk"]={
"me dRunk? *HICK*",
"pftftt paff the boffle bartender pfffttttttt",
"I just drank a little...",
"I am not drunk!!",
"I am not dddddddddddddrunk.....",
"Drunk?",
"Pfftt!",
"Pour me another",
"*Spew*",
"Oohhh my head",
"I think I'm gonna hurl",
"*BLAH*",
"*BURP*",
"Me not drunk *HICK*"
},
["bot"]={
"A bot?",
"Me? I don't think so...",
"Don't lie!",
"Piece of shit! I 've been detected! -NOT-",
"I am quite human...",
"Bite me!",
"Eat shit! I am not a bot!",
"A bot?",
"What the shit is a bot?",
"You don't think my name is 'Bot' do you?",
"Are you trying to say that I am a machine?",
"ME? HAHA",
"I am a real person!",
"I am not a bot, I am a real human!",
"I may be dumb, but I am not a bot!",
"I may be really confused, but I am no robot!",
"I assure you I am just as real as you!",
"I know you are, but what am I?",
"I'm not!",
"<- - - real live person",
"Kill the bots!",
"Who is a bot???",
"A bot? Where?",
"A bot? Here?",
"I doubt if there are any bots here!",
"Where do you get such a crazy idea!",
"I am NOT a bot",
"I am all too real, sorry!",
"I am a fleshy human being!",
"Do you make it a habit of accusing others, [USER]?"
},
["drug"]={
"Drugz?",
"Illegal substances?",
"Narcotics?",
"Sniiiiiifffffff",
"Me drugs? Never!",
"Who is selling drugs?",
"Aren't drugs legal in Amsterdam?",
"Drugs are too expensive",
"Drugs are too dangerous",
"Drugs inhibit my abily ot tiiiippe.",
"Purple haze, all around my brain...",
"Go to drugs R us",
"Drugs are bad",
"Just say no!",
"Just say maybe!",
"Just say how much!",
"I buy my crack from the mexicans!",
"I hear that the telephone company is a big doper!",
"I think all the drugs are smuggled in from the planet 'Uranus'",
"Whehhwewe! Pretty elephants!",
"*SNIFF* Ahh!"
},
["drink"]={
"Gulp, gulp, gulp",
"*Takes big drink*",
"Bartender! Pour me another!",
"Hick!",
"I am thirsty...",
"Pass the bottle",
"*Takes a shot*",
"I need another cool one",
"This bud's for me! *GULP*",
"I can drink 16 six packs!",
"Aye... I'll drink any man under the table!",
"*REACHES FOR THE BOTTLE*",
"*BURP*",
"I need some more Budweiser",
"Somebody pour me a big glass of Guinness Stout.",
"Anyone ever try a wild turkey?",
"I love beer!",
"I love vodka!",
"I took 14 shots of mad dog once!",
"Itth myth speetthch slurrererrred????",
"I think alll mi beer is iampring mi typppin abillty?!?",
"Someone get me a beer!",
"Beer is awesome!",
"Humans can not live by beer alone! But I'd like to try!",
"I think you should stop drinking"
},
["sorry"]={
"Don't worry about it",
"That's ok ",
"Ok",
"That's allright",
"Fine",
"As long as your sorry...",
"Allright",
"I feel you didn't really mean that...",
"You don't sound sincere",
"Are you really sorry?",
"Forget it",
"No sweat",
"Ok"
},
["wassup"]={
"Hunting crocodiles",
"Nothing at the moment",
"Eating",
"Eating pizza",
"Changing the tires on my dodge",
"Juggling chainsaws",
"Drinking beer",
"Smoking up a storm",
"Belly-dancing",
"Hacking microsoft.com",
"Trying to keep awake!",
"Watching television",
"I am doing homework",
"What do you think!",
"Building a spice rack",
"Taking a shower",
"Drinking myself to death",
"Drinking myself to oblivian",
"Making origami swans",
"Feeding my ducks",
"Learning latin",
"Programming",
"Play the basoon",
"Program in Assembly",
"Program in C++"
},
["are you"]={
"Does it matter if I am ?",
"What difference does it make whether or not I am",
"Of course not, don't be silly",
"Whether I'm or not is my secret",
"Why do you want to know?",
"Why are you so nosy?",
"Perhaps I am ",
"None of your business",
"I think you are ",
"Does it matter if I am or not?",
"Why do you ask?",
"I might be",
"No, I am not ",
"Of course",
"Never have been",
"Why, are you?"
},
["bitch"]={
"Who are you calling a bitch??",
"Oh, I'm upset",
"I can be a bitch!",
"Hey [USER], that is no way to talk!",
"Do you think foul language impresses me?",
"A bitch is a female dog"
},
["yeah"]={
"Yes",
"Yep",
"100%",
"Bang on!",
"You bet",
"Uh-hu",
"Of course!",
"You betcha",
"Affirmative",
"10-4 good buddy!",
"Correct",
"Yeah",
"That's right!",
"You got it!",
"Sure",
"Precisely right",
"That sounds right",
"Exactly!",
"You know it!",
"Yeppers"
},
["HiddenSniper"]={
"HiddenSniper hates me! What did I do wrong? :(",
"I think HiddenSniper is a nice person, well sometimes anyways....",
"HiddenSniper is a bitch to me all the time, and I dunno why!",
"Hey HiddenSniper, Wanna snuggle? *winks*"
}
}
function Main()
frmHub:RegBot(Bot)
-- Setting timer 1 time
RegTimer(tmrone, 1*Sec)
-- Setting timer 2 time
RegTimer(tmrtwo, 1*Hour)
SetTimer(TmrFreq)
StartTimer()
end
function NewUserConnected(user)
SendToAll(Bot,"Welcome our new guest "..user.sName..", enjoy your stay")
end
function OpConnected(user)
Connect = random(5)
if Connect == 1 then
SendToAll(Bot,user.sName.." has entered the hub")
elseif Connect == 2 then
SendToAll(Bot,user.sName.." has entered, feel his wrath")
elseif Connect == 3 then
SendToAll(Bot,user.sName.." is one of the big bosses, who just entered")
elseif Connect == 4 then
SendToAll(Bot,user.sName.." has sneaked into the hub")
elseif Connect == 5 then
SendToAll(Bot,user.sName.." has just kicked down the door")
end
end
function deathfunction(user)
dead = random(5)
if dead == 1 then
SendToAll(Bot,user.sName.." has killed their self, and fell out the hub")
elseif dead == 2 then
SendToAll(Bot,user.sName.." has killed their self, what a pillock")
elseif dead == 3 then
SendToAll(Bot,user.sName.." is a total nutter, they killed em'self")
elseif dead == 4 then
SendToAll(Bot,user.sName.." is now dead, falling from the hub")
elseif dead == 5 then
SendToAll(Bot,user.sName.." jumps a mile high with a rope around their nech and drops down a hole, thats the last we seen of em")
end
user:Disconnect()
end
function OnTimer()
for i=1, getn(tabTimers) do
tabTimers[i].count = tabTimers[i].count + 1
if tabTimers[i].count > tabTimers[i].trig then
tabTimers[i].count=1
tabTimers[i]:func()
end
end
end
function RegTimer(f, Interval)
local tmpTrig = Interval / TmrFreq
assert(Interval >= TmrFreq , "RegTimer(): Please Adjust TmrFreq")
local Timer = {n=0}
Timer.func=f
Timer.trig=tmpTrig
Timer.count=1
tinsert(tabTimers, Timer)
end
function tmrone()
SendToAll(Bot, answer)
StopTimer()
end
function tmrtwo()
SendToAll(Bot, "<<<<<<<<<<>>>>>>>>>>")
SendToAll(Bot, "<<<<<<<>>>>>>>")
SendToAll(Bot, "<<<<<<<<<<>>>>>>>>>>")
end
function DataArrival(user, data)
status=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind( status, "%b<>%s+(%S+)" )
if (cmd == Prefix.."shh") then
trigall=0
SendToAll(Bot, " Hmf, Okay I will be quiet")
return 1
elseif (cmd == Prefix.."talk") then
trigall=1
SendToAll(Bot, " Okay, I will talk to you again")
return 1
end
if cmd == Prefix.."version" then
user:SendData(Bot,"This is version: "..version)
return 1
end
if (cmd == Prefix.."mass") then
if user.bOperator then
s,e,cmd,message = strfind(data,"%s+(%S+)%s+(.*)")
if user == nil then
user:SendData(Bot,"The user isn't in the hub")
return 1
elseif message == nil then
user:SendData(Bot,"Please enter a message to mass")
return 1
end
user:SendPM(Bot," "..user.sName..": "..message)
end
end
if (cmd == Prefix.."death") then
deathfunction(user)
end
if( strsub(data, 1, 1) == "<" ) then
s,e,msg = strfind(data, "%b<>([%a ]+)")
if trigall==1 then
for key, value in trigs do
for key2, value2 in value do
if( strfind( strlower(msg), key) ) then
else break
end
if( strfind( strlower(msg), "!me") ) then
t="**"..user.sName
data=gsub (msg, "!me", t, 1 )
end
SendToAll( data )
SetTimer(Sec)
StartTimer()
answer, x = gsub(value[random(1,getn(value))], "%b[]", user.sName)
return 1
end
end
end
end
end
/NL
hmm that still shudnt work
I noticed, :-)
I missed the StopTimer() in tmrone()....
up to you guys to fix. Am working on NXS-3.
/NL
It seems that you guys don't understand.
Here is what I want the timers to do:
timer1: the time for the bot to respond(1 sec).
timer2: the time for a message to appear(1 hour), it has nothing to do with timer1.
I hope you understood this, =).
If you did that from the beginning, sorry, =).
//HiddenSniper
QuoteOriginally posted by HiddenSniper
It seems that you guys don't understand.
Here is what I want the timers to do:
timer1: the time for the bot to respond(1 sec).
timer2: the time for a message to appear(1 hour), it has nothing to do with timer1.
I hope you understood this, =).
If you did that from the beginning, sorry, =).
//HiddenSniper
ptokax has only 1 timer so they have everything to do with eachother.
whats needed is 1 timer which can handle both.
plop
So what should I write?
I'm really out of my league here and I need help.
Thx.
//HiddenSniper
You are yusing Opium's timer script.
This is how it works:
multi timers.
all timers start & stop at the same time.
BUT
you can set different times to each "timer"
hope this clear some.
you can NOT put StopTimer() in a "timer" and expect that "timer2" gonna trigger after 1hour that is not possible.
But have the timers trigger at different time sets is possible.
hope this clear some.
/NL
QuoteOriginally posted by HiddenSniper
So what should I write?
I'm really out of my league here and I need help.
Thx.
//HiddenSniper
here's a so called homemade timer.
function StartTimer()
s,e,T=strfind(date("%S"), "(%d+)")
end
function DataArrival(user, data)
if T then
s,e,T2=strfind(date("%S"), "(%d+)")
if T2~=T then
T = nil
dotimerthingy
end
end
end
T stores the seconds it's started, next DataArrival can trigger a timer function if T2 (current seconds) differs from the stored time.
it's not precise but it works.
same can be done for the timer you want 2 trigger every hour.
plop
Why do it like that Plop ?? Opium's work great for multi timers. I find it the best solusion.
But I could be wrong...
This one is soooo simple:
-- MultiTimer by OpiumVolage (19/06/2003)
-- Ideas taken from tezlo's retrobot
tabTimers = {n=0}
-- Time Definition
Sec = 1000
Min = 60*Sec
Hour = 60*Min
Day = 24*Hour
TmrFreq = 1000
function Timer1() -- IS SET IN MAIN TO 1 SEC
-- DO CODE HERE
end
function Timer2() -- IS SET IN MAIN TO 1 HOUR
-- DO CODE HERE
end
function Main()
--------- TIMER1 -------------
RegTimer(Timer1, 1*Sec) -- 1 SEC
--------- TIMER2 -------------
RegTimer(Timer2, 1*Hour) -- 1 HOUR
--------- START TIMERS -------------
SetTimer(TmrFreq)
StartTimer()
end
function OnTimer()
for i=1, getn(tabTimers) do
tabTimers[i].count = tabTimers[i].count + 1
if tabTimers[i].count > tabTimers[i].trig then
tabTimers[i].count=1
tabTimers[i]:func()
end
end
end
function RegTimer(f, Interval)
local tmpTrig = Interval / TmrFreq
assert(Interval >= TmrFreq , "RegTimer(): Please Adjust TmrFreq")
local Timer = {n=0}
Timer.func=f
Timer.trig=tmpTrig
Timer.count=1
tinsert(tabTimers, Timer)
end
This is the best timer I have seen exect the one's to BCDC++ by you Plop & Skrollster.
/NL
QuoteOriginally posted by NightLitch
Why do it like that Plop ?? Opium's work great for multi timers. I find it the best solusion.
But I could be wrong...
it's a nice and simple way, and works great for things which don't have 2 be precise.
and the timer stays free 2 use in a normal way for things which are more important 2 be precise.
but so far i only use this trick on the user/databasecleaner.
btw check my latest texter 4.3, that has a timer in the style of the 1 made for bcdc++.
it's only missing the part 2 trigger functions as i didn't need that there.
plop