An Original TimeBot
 

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

An Original TimeBot

Started by WooshMan, 06 March, 2004, 11:15:22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WooshMan

This is my first submission for finished scripts and hopefully it is an original one.

-- timebot by WooshMan -- landofkaraoke.ath.cx
-- creates a dummy user at the top of the user list
-- and displays the time as the user name.
-- A clock which diplays the current time in Hours and minutes.

current = date("%H:%M")
min = 1000*60 

--------------------------------------------------------
function Main() 
	frmHub:RegBot("---" ..current .."---")
	SetTimer(min) 
	StartTimer() 
end 
--------------------------------------------------------
function OnTimer()
	frmHub:UnregBot("---" ..current .."---")
	time = date("%H:%M")
	current = time
	frmHub:RegBot("---" ..current .."---")
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot("---" ..current .."---")
end
--------------------------------------------------------
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

kepp

Guarding    

WickeD

Good one!!!  It works too!!  =)

//WickeD

WooshMan

Here is a H:M:S version

-- timebot by WooshMan -- landofkaraoke.ath.cx
-- creates a dummy user at the top of the user list
-- and displays the time as the user name.
-- A clock which diplays the current time in Hours, Minutes and Seconds.

current = date("%H:%M:%S")
sec = 1000

--------------------------------------------------------
function Main() 
	frmHub:RegBot("---" ..current .."---")
	SetTimer(sec) 
	StartTimer() 
end 
--------------------------------------------------------
function OnTimer()
	frmHub:UnregBot("---" ..current .."---")
	time = date("%H:%M:%S")
	current = time
	frmHub:RegBot("---" ..current .."---")
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot("---" ..current .."---")
end
--------------------------------------------------------

But when there is quite a lot of users in the hub.. the user list may flicker slightly.. but the overall effect of seconds on the clock is much nicer.

--14:34:24--

WooshMan
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

[NL]trucker

WoW
WooshMan

A great job and a nice one if i may say.

i really like it,

one question is it possiblle to add a description for it like
=current time= ?

thnx peter.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


NightLitch

Nice Woosh, your skills are improving m8.

/NL
//NL

WooshMan

#6
New Version:  But still working on it.

-- timebot by WooshMan -- landofkaraoke.ath.cx

-- creates a dummy user at the top of the user list
-- and displays the time as the user name.
-- A clock which diplays the current time in Hours and minutes.

-- Version 1.3
-- ops only can turn on and off
-- added !clockon and !clockoff.  Turns clock on and off
-- added characters to start and end of time.  User can choose anything to prefix and finish the clock

startchrs = "-*"   -- shows before clock
endchrs = "*-"    -- shows after clock

current = date("%H:%M:%S")
sec = 1000
min = sec*60
--------------------------------------------------------
function Main() 
	SetTimer(sec)
end 
--------------------------------------------------------
function OnTimer()
	frmHub:UnregBot(startchrs ..current ..endchrs)
	time = date("%H:%M:%S")
	current = time
	frmHub:RegBot(startchrs ..current ..endchrs)
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot(startchrs ..current ..endchrs)
end
--------------------------------------------------------
function DataArrival(user, data)
	if( strsub(data, 1, 1) == "<" ) then
	if user.bOperator then
	local s,e,prefix,cmd = strfind(data, "%b<>%s+(%S+)(%S+)") 
		if prefix == "!clockoff" then
			StopTimer()
			frmHub:UnregBot(startchrs ..current ..endchrs)
			return 1
		elseif prefix == "!clockon" then
			current = date("%H:%M:%S")
			StartTimer() 
			frmHub:RegBot(startchrs ..current ..endchrs)
			return 1
		end	
	end
	end
end  

I will look at adding description for it Trucker.

Thanks NL... your help has got me this far :-)
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

pHaTTy

see problem with this is sending myinfo to all every second, ever heard of ruri destroyer 1?, well it does the same, faster tho i think, well u are technically doing the saame with a lau script, just so u know,

later,,
Resistance is futile!

kepp

well, ruri's goes alot faster, i could guess 400 ms
Guarding    

WooshMan

Good point.

OK.. I will complete the script using Hours and minutes as then it will only send every minute, which will be no different to a large hub with useres joining and leaving.

Thanks for pointing that out to me.

Woosh
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

pHaTTy

QuoteOriginally posted by WooshMan
Good point.

OK.. I will complete the script using Hours and minutes as then it will only send every minute, which will be no different to a large hub with useres joining and leaving.

Thanks for pointing that out to me.

Woosh

np, but otherwise its a very good idea, makes some animation for a change on dc :)
Resistance is futile!

??????Hawk??????

#11
nice script WooshMan :-)
added  bot description / email / speed



-- A clock which diplays the current time in Hours and minutes.

-- Version 1.3
-- ops only can turn on and off
-- added !clockon and !clockoff.  Turns clock on and off
-- added characters to start and end of time.  User can choose anything to prefix and finish the clock
-- code added to give other bot info by ??????Hawk??????  06-03-04
startchrs = "-*"   -- shows before clock
endchrs = "*-"    -- shows after clock
gb = 15 * 1024 * 1024
botDesc = "I can tell the time" 
botSpeed = "slow" 
botEmail = "clocks@mynet.com" 
botShare = 1 * 1024 * gb

current = date("%H:%M:%S")
sec = 1000
min = sec*60
--------------------------------------------------------
function Main() 
	SetTimer(sec)
end 
--------------------------------------------------------
function OnTimer()
	frmHub:UnregBot(startchrs ..current ..endchrs)
	time = date("%H:%M:%S")
	current = time
	frmHub:RegBot(startchrs ..current ..endchrs)
 	info = "$MyINFO $ALL -*"..current.."*- "..botDesc.."$ $"..botSpeed..strchar( 1 ).."$"..botEmail.."$"..botShare.."$" 
	SendToAll( info )
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot(startchrs ..current ..endchrs)
end
--------------------------------------------------------
function DataArrival(user, data)
	if( strsub(data, 1, 1) == "<" ) then
	if user.bOperator then
	local s,e,prefix,cmd = strfind(data, "%b<>%s+(%S+)(%S+)") 
		if prefix == "!clockoff" then
			StopTimer()
			frmHub:UnregBot(startchrs ..current ..endchrs)
			return 1
		elseif prefix == "!clockon" then
			current = date("%H:%M:%S")
			StartTimer() 
			frmHub:RegBot(startchrs ..current ..endchrs)

			return 1
		end	
	end
	end
end  
--------------------------------------------------------------------------------

Skrollster

please use [code] tags then you post any code, it is much esier to read then..

NightLitch

Damn to slow, you got before me Skroll. :-)
//NL

Skrollster


Skrollster

if you don't want your script to check the time every sec, though it might be very cpu expensive, check out my old script:

timerintervall = 3 -- Number of hours between timeractions

function oneveryhour()
	local sHour = date("%H")
	local sMin = date("%M")
	if sMin=="00" then
		SendToAll("Time", "\t\t\t\t- = [ " ..sHour.. ":" ..sMin.. " o'clock ] = - ")
	end
	StopTimer()
	local sHour,sSec,sMin = tonumber(date("%H")),tonumber(date("%S")),tonumber(date("%M")) --(sHour*60*60*1000)
--	local sSec,sMin = tonumber(date("%S")),tonumber(date("%M"))

	SetTimer(timerintervall*60*60*1000-(mod(sHour/24,timerintervall)*60*60*1000)-(sMin*60*1000)-(sSec*1000)+(1*1000))
	StartTimer()
end

function OnTimer()
	oneveryhour()
end

function Main()
	local sSec,sMin = tonumber(date("%S")),tonumber(date("%M"))
	SetTimer(60*60*1000-(sMin*60*1000)-(sSec*1000)+(1*1000))
	StartTimer()
end--Skrollster 2003-07-18

WooshMan

Fantastic Hawk.... I will try it tomorrow.  TY

Saves me doing it :-)

As for not using seconds Skroller, change timer to min and remove the :%S and thats all you need to do.

But thanks for your old script.

Woosh
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

Skrollster

my bad, didn't check what the script did.. sorry.. ;)

Sky

Top Marks Woosh m8
We've got 2 Brains on our network now
hope you have more to follow this TimeBot
:c) :D

Skrollster

after thinking a while i realise this can't be healthy for your upload... at least not for bigger hubs...

2000 users x 1 messages per sec...

each message is about 130 byte

($Quit -*00:00:00*-|
$Hello -*00:00:01*-|
$MyINFO $ALL -*00:00:01*- I can tell the time$ $slow1$clocks@mynet.com$16106127360$|)

this means about 250kbyte/sec

and this more then most of you have....
and this is only for this bot alone...

WooshMan

I see your point.....

Hence the minute script.. it just so happened I updated the seconds script....

I will write the full script for minutes only, which will save all of that bandwidth.
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

Skrollster


pHaTTy

QuoteOriginally posted by Skrollster
after thinking a while i realise this can't be healthy for your upload... at least not for bigger hubs...

2000 users x 1 messages per sec...

each message is about 130 byte

($Quit -*00:00:00*-|
$Hello -*00:00:01*-|
$MyINFO $ALL -*00:00:01*- I can tell the time$ $slow1$clocks@mynet.com$16106127360$|)

this means about 250kbyte/sec

and this more then most of you have....
and this is only for this bot alone...


ya i was talking to trucker about the same thing eheh, just as well u posted it,, id of forgot lmao
Resistance is futile!

Skrollster

but it wasn't as bad as i would have thought though..

pHaTTy

hmm i dunno, i seen in a few hubs, and it took me 2-3 mins to get in, and the time was skipping 6-7 seconds a time,
Resistance is futile!

SMF spam blocked by CleanTalk