Something special for Dessamator;
I?d loaded the followin (but i didn?t find it again), and it runs perfectly...GREAT WORK! One of my favorites...
-- small mod now shows countdown in topic also
--lua5 version
--made by Dessamator borrowing some ideas from timebot
HubName= frmHub:GetHubName()
sBot = frmHub:GetHubBotName()
sec = 1000
min = sec*60
botDesc = "Re-Starter"
botSpeed = "DSL"
botEmail = "AB@C.de"
botShare = 0
startchars ="-------" -- shows before
endchrs = "-------" -- shows after
--------------------------------------------------------
function Main()
SetTimer(sec)
end
--------------------------------------------------------
function OnTimer()
if time > 0 then
frmHub:UnregBot(startchars..time..endchrs)
time = time - 1
SendToAll("$HubName "..HubName.." ------- - HUB-RESTART in "..startchars..time..endchrs.." SECS -------")
frmHub:RegBot(startchars..time..endchrs)
else
SendToAll("$HubName "..HubName.." ------- - HUB-RESTART in "..startchars..time..endchrs.." SECS -------")
frmHub:UnregBot(startchars..time..endchrs)
frmHub:Restart()
end
end
--------------------------------------------------------
--------------------------------------------------------
function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if (string.lower(cmd) == "!restartimer") then
timer(user, data)
return 1
end
end
ToArrival=ChatArrival
function timer(user,data)
Nick = user
local s,e,input = string.find(data, "%b<>%s+%S+%s+(.+)")
if input== nil or tonumber(input)==nil then
SendPmToNick(user.sName,sBot, "Syntax Error, Write: !restartimer ")
elseif user.iProfile==5 or user.iProfile==0 then
time=tonumber(input)
StartTimer()
SendToAll(sBot,"------- HUB-RESTART in "..time.." SECS -------")
SendToAll("$HubName "..HubName.." ------- - HUB-NEUSTART in "..startchars..time..endchrs.." SECS -------")
frmHub:RegBot(startchars..time..endchrs)
else
user:SendData(sBot,"Youre not allowed to...!")
return 1
end
end
__________________________________
My quest @ YOU:
Can you modify this one so that it:
A)
...workes automaticly, will say- it starts with the hub without any manualy command and counts
an time from 24h ascending to 0 and than restarts the hub;
but i will can cut it and start manualy, if needed...like it now do.
B)
...is seen in topic the hole time and gives an Main-Message every 30 Minutes within the actually
time, when the hub will restart.
C)
It should be written in Minutes, cause of the lenght in Topic...but the last 60 Minutes the script
should tell the resttime in main and topic in seconds like it now do.
D)
May you can change the command from !restartimer to
!countdown.
If that is possible and done it will be my
>>> TOP-FAVORITE!!!
yep , im almost done , ill post it a.s.i.f.
Goil! :P
I?ll waitin... ;)
--By Dessamator borrowing some ideas from timebot
--Restart-Topic-Timer v2 (requested by B@BE)
--added Automatic restart after x time
--added Automatic warn of hub restart in interval
sec = 1000
min = sec*60
hour= min*60
day= hour*24
HubName= frmHub:GetHubName()
--> Config <--
-->bot config<--
sBot = frmHub:GetHubBotName() -- Bot Name
botDesc = "Re-Starter"
botSpeed = "DSL"
botEmail = "AB@C.de"
botShare = 0
startchars ="-------" -- shows before
endchrs = "-------" -- shows after
-->bot config<--
-->Settings <--
time=24*60 -- Time to wait before restarting the hub in minutes
iWarn=30 -- warn Interval in minutes
Usrcmdon = true -- to enable right click --> true/false
-->Settings <--
--> Config <--
--------------------------------------------------------
function Main()
SetTimer(min)
StartTimer()
SendToAll("$HubName "..HubName.." ------- - HUB-NEUSTART in "..startchars..time..endchrs.." minutes -------")
end
--------------------------------------------------------
--User Command --
function OpConnected(user)
if Usrcmdon and user.iProfile==0 or user.iProfile == 5 then
user:SendData("$UserCommand 1 3 CountDown\\Countdown$<%[mynick]> !countdown %[line:time in seconds]|")
user:SendData("$UserCommand 1 3 CountDown\\Stop Countdown$<%[mynick]> !stopcountdown|")
end
end
--------------------------------------------------------
function OnTimer()
if time > 0 then
frmHub:UnregBot(startchars..time..endchrs)
time = time - 1
if MassMin==nil then
MassMin=1
elseif MassMin == iWarn then
SendToAll(sBot,"------- HUB-RESTART in "..time.." minutes -------")
MassMin=nil
else MassMin= MassMin + 1
end
SendToAll("$HubName "..HubName.." ------- - HUB-RESTART in "..startchars..time..endchrs.." SECS -------")
frmHub:RegBot(startchars..time..endchrs)
else
SendToAll("$HubName "..HubName.." ")
frmHub:UnregBot(startchars..time..endchrs)
frmHub:Restart()
time=nil
SetStuff(false)
end
if time==1 and not SetStuff(true) then
frmHub:UnregBot(startchars..time..endchrs)
time=60
SetStuff(true)
end
end
--------------------------------------------------------
--------------------------------------------------------
function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if (string.lower(cmd) == "!countdown") then
timer(user, data)
return 1
elseif (string.lower(cmd) == "!stopcountdown") then
if user.iProfile==0 or user.iProfile == 5 then
StopTimer()
SendToAll(sBot,"Hub Restart has been posponed for now !")
SendToAll("$HubName "..HubName.." ")
frmHub:UnregBot(startchars..time..endchrs)
end
return 1
end
end
ToArrival=ChatArrival
function timer(user,data)
local s,e,input = string.find(data, "%b<>%s+%S+%s+(.+)")
if input== nil or tonumber(input)==nil then
SendPmToNick(user.sName,sBot, "Syntax Error, Write: !countdown ")
elseif user.iProfile==5 or user.iProfile==0 then
time=tonumber(input)
SetStuff(true)
SendToAll(sBot,"------- HUB-RESTART in "..time.." SECS -------")
SendToAll("$HubName "..HubName.." ------- - HUB-NEUSTART in "..startchars..time..endchrs.." SECS -------")
frmHub:RegBot(startchars..time..endchrs)
else
user:SendData(sBot,"Youre not allowed to...!")
return 1
end
end
function SetStuff(status)
SetTimer(sec)
return status
end
Done !
Hu! Thx, for speed!!! :D
I?ll check it tomorrow.
Must go to a party now... ;)
ur welcome ! hope it works the way u want it to work :)
My "TOP"ic- Favorite ! :P
Works absolutly fine without any changin...
Very fine work >>> "Dessi" *gfg*:
Thank YOU ! very much... ;)
yikes, no bugs , thats a first, anyways ur welcome :]
--By Dessamator borrowing some ideas from timebot
--Restart-Topic-Timer v2a (requested by B@B€)
--added Automatic restart after x time
--added Automatic warn of hub restart in interval
--added on/off switch for the auto restart timer
sec = 1000
min = sec*60
hour= min*60
day= hour*24
HubName= frmHub:GetHubName()
--> Config <--
-->bot config<--
sBot = frmHub:GetHubBotName() -- Bot Name
botDesc = "Re-Starter"
botSpeed = "DSL"
botEmail = "AB@C.de"
botShare = 0
startchars ="-------" -- shows before
endchrs = "-------" -- shows after
-->bot config<--
-->Settings <--
time=24*60 -- Time to wait before restarting the hub in minutes
iWarn=30 -- warn Interval in minutes
Usrcmdon = false -- to enable right click --> true/false
AutoRestart =true -- automatic restart --> true/false
-->Settings <--
--> Config <--
--------------------------------------------------------
function Main()
if AutoRestart then
SetTimer(min)
StartTimer()
SendToAll("$HubName "..HubName.." ------- - HUB-NEUSTART in "..startchars..time..endchrs.." minutes -------")
end
end
--------------------------------------------------------
--User Command --
function OpConnected(user)
if Usrcmdon and user.iProfile==0 or user.iProfile == 5 then
user:SendData("$UserCommand 1 3 CountDown\\Countdown$<%[mynick]> !countdown %[line:time in seconds]|")
user:SendData("$UserCommand 1 3 CountDown\\Stop Countdown$<%[mynick]> !stopcountdown|")
end
end
--------------------------------------------------------
function OnTimer()
if time > 0 then
frmHub:UnregBot(startchars..time..endchrs)
time = time - 1
if AutoRestart then
if MassMin==nil then
MassMin=1
elseif MassMin == iWarn then
SendToAll(sBot,"------- HUB-RESTART in "..time.." minutes -------")
MassMin=nil
else MassMin= MassMin + 1
end
end
SendToAll("$HubName "..HubName.." ------- - HUB-RESTART in "..startchars..time..endchrs.." SECS -------")
frmHub:RegBot(startchars..time..endchrs)
else
SendToAll("$HubName "..HubName.." ")
frmHub:UnregBot(startchars..time..endchrs)
frmHub:Restart()
--htime=nil
SetStuff(false)
end
if time==1 and not SetStuff(true) then
if AutoRestart then
frmHub:UnregBot(startchars..time..endchrs)
time=60
SetStuff(true)
end
end
end
--------------------------------------------------------
--------------------------------------------------------
function ChatArrival(user, data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if (string.lower(cmd) == "!countdown") then
timer(user, data)
return 1
elseif (string.lower(cmd) == "!stopcountdown") then
if user.iProfile==0 or user.iProfile == 5 then
StopTimer()
SendToAll(sBot,"Hub Restart has been posponed for now !")
SendToAll("$HubName "..HubName.." ")
frmHub:UnregBot(startchars..time..endchrs)
end
return 1
end
end
ToArrival=ChatArrival
function timer(user,data)
local s,e,input = string.find(data, "%b<>%s+%S+%s+(.+)")
if input== nil or tonumber(input)==nil then
SendPmToNick(user.sName,sBot, "Syntax Error, Write: !countdown ")
elseif user.iProfile==5 or user.iProfile==0 then
time=tonumber(input)
SetStuff(true)
SendToAll(sBot,"------- HUB-RESTART in "..time.." SECS -------")
SendToAll("$HubName "..HubName.." ------- - HUB-NEUSTART in "..startchars..time..endchrs.." SECS -------")
frmHub:RegBot(startchars..time..endchrs)
else
user:SendData(sBot,"Youre not allowed to...!")
return 1
end
end
function SetStuff(status)
SetTimer(sec)
return status
end
Mmmh, let?s see...
A)
New is an 2 Min-Timer - OK ;)
But i don?t understand the 2nd?
If i give the right-click-command to stop or stop it
manualy it would do this. Why this Edit?
B)
An On/Off Switch
Please tell me wherefore it is? :))
btw: i?ve not tested this new one...
QuoteOriginally posted by B@B€
Mmmh, let?s see...
A)
New is an 2 Min-Timer - OK ;)
But i don?t understand the 2nd?
B)
An On/Off Switch
Please tell me wherefore it is? :))
btw: i?ve not tested this new one...
hmm, "a)" 2 min timer was a debugging code , ive removed it.
QuoteIf i give the right-click-command to stop or stop it
manualy it would do this. Why this Edit?
i edited it like this, to avoid other requests since this script has 2 functions, the timer can work automatically or it can be activated , so i put an on /off switch for the auto timed restart
b) its here :
AutoRestart =true -- automatic restart --> true/false
leave it with --> true , if u want the hub to restart automatically after some hours, and false if u prefer to start the timer automatically using the right click or whatever
either way the changes i made shouldnt affect the hub, it will run in the same way as b4 :)
Aaaah... :rolleyes:
So if i let it as "True" it restarts after the given 24 hours.
And if there is written "false", it only starts end ends manually-
Correct? *grummel* ?(
QuoteOriginally posted by B@B€
Aaaah... :rolleyes:
So if i let it as "True" it restarts after the given 24 hours.
yep
And if there is written "false", it only starts and ends manually-
Correct? *grummel* ?(
hmm, not really, it starts manually, and ends automatically. after the specified time in seconds, :)
Mmh...OK, another way...*ggg* :D
(Sorry) ;)
At this time, the script starts auto with the hub and shows me the runnin time in user-list. (Tested)
It ends after 24 hours and restarts the hub. (Tested)
If i stop the countdown (e.g. trough RC-Command or manually with "!stopcountdown" it stops (Tested) .
The only thang is- if i start again manually, it shows the time i?ve given in seconds.
(so i must be good in Mathematic...hehe) :D
_________________________
Well, that?s it.
And what does the new one do what my "old" does not?
May i can?t understand cause i?m stupid...*gfg* ?(
QuoteOriginally posted by B@B€
Mmh...OK, another way...*ggg* :D
(Sorry) ;)
At this time, the script starts auto with the hub and shows me the runnin time in user-list. (Tested)
It ends after 24 hours and restarts the hub. (Tested)
If i stop the countdown (e.g. trough RC-Command or manually with "!stopcountdown" it stops (Tested) .
The only thang is- if i start again manually, it shows the time i?ve given in seconds.
(so i must be good in Mathematic...hehe) :D
_________________________
Well, that?s it.
And what does the new one do what my "old" does not?
May i can?t understand cause i?m stupid...*gfg* ?(
hmm ur not stupid, maybe im confusing you :)
the new one only has that feature i talked about, to enable automatic hub restart after 24 hours immediately after the hub is started or
disable it :]
NooooooooooooooooW!... 8o
OK...hihi...
(I?m a silly goat...chrchr)
As YOU said; we?d talk passing the way... ;)
Is it my english or what?s up? *g*
EXCUSE ME! plz 4 nerve you ...and THX!
(But i want to know the hole functions of an script, if
possible, therefore i ask more and more times...into
Noooooooooooooow!) :P
lol, ok, ask away, tis far easier to answer questions than to debug a script :)
I?ll do so! :D Believe...hihi ;)
A lot of in Lua 4 i?ve changed 4 my needs...
(...with a lot of tests...)
A lot (so i think) i understand, but i?m also sure;
I?m not an Professional...hehe
OK, must cookin now... :(
Again: THX! for [D@] fine work!!!
C ya ;)
ur welcome, and bon apetit :)