Restart-Topic-Timer
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Restart-Topic-Timer

Started by B@B?, 04 June, 2005, 10:48:02

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

B@B?

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!!!
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

yep , im almost done , ill post it a.s.i.f.
Ignorance is Bliss.

B@B?

#2
Goil!  :P

I?ll waitin... ;)
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

#3
--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 !
Ignorance is Bliss.

B@B?

Hu! Thx, for speed!!! :D

I?ll check it tomorrow.

Must go to a party now... ;)
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

ur welcome ! hope it works the way u want it to work :)
Ignorance is Bliss.

B@B?

My "TOP"ic- Favorite !  :P

Works absolutly fine without any changin...

Very fine work  >>> "Dessi" *gfg*:

Thank YOU ! very much... ;)
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

yikes, no bugs , thats a first, anyways ur welcome   :]
Ignorance is Bliss.

Dessamator

#8
--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
Ignorance is Bliss.

B@B?

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...
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

#10
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 :)
Ignorance is Bliss.

B@B?

#11
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*  ?(
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

#12
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, :)
Ignorance is Bliss.

B@B?

#13
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*  ?(
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

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  :]
Ignorance is Bliss.

B@B?

#15
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
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

lol, ok, ask away, tis far easier  to answer questions than to debug a script :)
Ignorance is Bliss.

B@B?

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  ;)
THE DAY AFTER...  

...is >>>>>>>> NOW!




Btw:
Plz excuse my english...
It?s not the best, i?m sure...but it?s funny...isn?t it?

Dessamator

ur welcome, and bon apetit :)
Ignorance is Bliss.

SMF spam blocked by CleanTalk