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
--------------------------------------------------------
Really Cool :)
Good one!!! It works too!! =)
//WickeD
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
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.
Nice Woosh, your skills are improving m8.
/NL
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 :-)
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,,
well, ruri's goes alot faster, i could guess 400 ms
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
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 :)
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
--------------------------------------------------------------------------------
please use [code] tags then you post any code, it is much esier to read then..
Damn to slow, you got before me Skroll. :-)
as always...
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
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
my bad, didn't check what the script did.. sorry.. ;)
Top Marks Woosh m8
We've got 2 Brains on our network now
hope you have more to follow this TimeBot
:c) :D
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...
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.
;)
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
but it wasn't as bad as i would have thought though..
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,
Hello again this is how mine is set up runs sweet updating once a min:-
Great script Woosh :-)
-- 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
-- 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 = "??????Hubs Local Time??????"
botSpeed = "Time"
botEmail = "clocks@hawks-world.com"
botShare = 1 * 1024 * gb
current = date("%H:%M:%S")
sec = 1000
min = sec*60
--------------------------------------------------------
function Main()
SetTimer(min)
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot(startchrs ..current ..endchrs)
time = date("%H:%M_Hrs_GmT")
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_Hrs_GmT")
StartTimer()
frmHub:RegBot(startchrs ..current ..endchrs)
return 1
end
end
end
end
--------------------------------------------------------------------------------
BTW.... the other info dosnt appear for 1 min on clock start
Part|Join messages spamming..
Is it any way to disable this message from bot on server side?
Any clients want to see part|join messages, but not from timebot =)
I want to add an alarm clock. Example, an user ,chat, and he doesn't want to forget an appointment. So set the hour of the appointment and when it is the hour the Bot sends him a message in mainchat. Is it possible?
Can eny one take away from this script the on/off funktion! So I do not need to start the Time script when I restart all scripts i the hubsoft! I want the Time script to bee on ON all the time!
-- 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
-- code added to give other bot info by ??????Hawk?????? 06-03-04
startchrs = "[Bot]-?-?-" -- shows before clock
endchrs = "-?-?-" -- shows after clock
gb = 15 * 1024 * 1024
botDesc = "??????Show local time in this hub??????"
botSpeed = "BOT"
botEmail = "support@northside.se"
botShare = 0 * 1024 * gb
current = date("%H:%M:%S")
sec = 1000
min = sec*60
--------------------------------------------------------
function Main()
SetTimer(min)
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot(startchrs ..current ..endchrs)
time = date("%H:%M")
current = time
frmHub:RegBot(startchrs ..current ..endchrs)
info = "$MyINFO $ALL [Bot]-?-?-"..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")
StartTimer()
frmHub:RegBot(startchrs ..current ..endchrs)
return 1
end
end
end
end
//WickeD
Hi,
Take out the DataArrival(user,data) part.
And in Main()
StartTimer()
frmHub:RegBot(startchrs ..current ..endchrs)
Add that.
That should put the clock in all the time.
Not tested though.
Woosh
Can you fix that for me? I can not get it to work!
Can you add that in the script and post it here??? Plzzz!
//WickeD
try this WickeD m8
-- 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
-- code added to give other bot info by ??????Hawk?????? 06-03-04 / removed switches 16-13-04
startchrs = "[Bot]-?-?-" -- shows before clock
endchrs = "-?-?-" -- shows after clock
gb = 15 * 1024 * 1024
botDesc = "??????Show local time in this hub??????"
botSpeed = "BOT"
botEmail = "support@northside.se"
botShare = 0 * 1024 * gb
current = date("%H:%M:%S")
sec = 1000
min = sec*60
--------------------------------------------------------
function Main()
SetTimer(min)
current = date("%H:%M")
StartTimer()
frmHub:RegBot(startchrs ..current ..endchrs)
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot(startchrs ..current ..endchrs)
time = date("%H:%M")
current = time
frmHub:RegBot(startchrs ..current ..endchrs)
info = "$MyINFO $ALL [Bot]-?-?-"..current.."-?-?- "..botDesc.."$ $"..botSpeed..strchar( 1 ).."$"..botEmail.."$"..botShare.."$"
SendToAll( info )
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot(startchrs ..current ..endchrs)
end
--------------------------------------------------------
It works fine now!!!! " My WickeD m8" =)
Thx a lot for your help!!
//WickeD
Is there a way to get the Description to bee there all the time?? It vanish from user list when I restart the scripts from hubsoft!
//WickeD
-- 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
-- code added to give other bot info by ??????Hawk?????? 06-03-04 / removed switches 16-13-04
startchrs = "[Bot]-?-?-" -- shows before clock
endchrs = "-?-?-" -- shows after clock
gb = 15 * 1024 * 1024
botDesc = "??????Show local time in this hub??????"
botSpeed = "BOT"
botEmail = "support@northside.se"
botShare = 0 * 1024 * gb
current = date("%H:%M")
sec = 1000
min = sec*60
info = "$MyINFO $ALL [Bot]-?-?-"..current.."-?-?- "..botDesc.."$ $"..botSpeed..strchar( 1 ).."$"..botEmail.."$"..botShare.."$"
--------------------------------------------------------
function Main()
SetTimer(min)
current = date("%H:%M")
StartTimer()
frmHub:RegBot(startchrs ..current ..endchrs)
SendToAll( info )
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot(startchrs ..current ..endchrs)
time = date("%H:%M")
current = time
frmHub:RegBot(startchrs ..current ..endchrs)
info = "$MyINFO $ALL [Bot]-?-?-"..current.."-?-?- "..botDesc.."$ $"..botSpeed..strchar( 1 ).."$"..botEmail.."$"..botShare.."$"
SendToAll( info )
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot(startchrs ..current ..endchrs)
end
--------------------------------------------------------
Now it is working!!!
//WickeD
hi WickeD
Although it didnt show on log in it would have appeared on timer trigger ( no more than 1 min on entring the hub )
is it possible to port this to lua5 (dchpp++)?
i tried using plops converter but i only get errors