Current time as Bot [API2]
 

Current time as Bot [API2]

Started by Cêñoßy†ê, 28 March, 2008, 14:44:17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cêñoßy†ê

--[[
	Small script to show hubs current time as user API2 by  C??o?y?? 28.03.2008
	v1
	-- Updates every 1 min
	-- Chars $|<>:?*"/\ and space not allowed in nick, $| not allowed in Description and Email, max length 64 chars per string.
	v2 -- Added seperate date & time requested by ResidentEvil
	-- Few what you might want to use ;)
		%a	abbreviated weekday name (e.g., Wed)
		%A	full weekday name (e.g., Wednesday)
		%b	abbreviated month name (e.g., Sep)
		%B	full month name (e.g., September)
		%d	day of the month (16) [01-31]
		%H	hour, using a 24-hour clock (23) [00-23]
		%I	hour, using a 12-hour clock (11) [01-12]
		%M	minute (48) [00-59]
		%m	month (09) [01-12]
		%p	either "am" or "pm" (pm)
		%S	second (10) [00-61]
		%w	weekday (3) [0-6 = Sunday-Saturday]
		%Y	full year (1998)
		%y	two-digit year (98) [00-99]
		%%	the character `%?
]]--

gmt = "GMT+02.00"
description = "?Hub Time?"
description2 = "?Hub Date?"
mail = "bot@hub.com"

function OnStartup()
	TmrMan.AddTimer(1*60000)
end

function OnTimer()
	if tmp then Core.UnregBot(tmp) end
	Core.RegBot(os.date("?[%H.%M]["..gmt.."]?"),description,mail,true)
	tmp = os.date("?[%H.%M]["..gmt.."]?")
	if tmp2 then Core.UnregBot(tmp2) end
	Core.RegBot(os.date("?[%d.%m.%Y]?"),description2,mail,true)
	tmp2 = os.date("?[%d.%m.%Y]?")
end
Powered By Leviathan™ 2nd Generation v. 1.9

ResidentEvil

#1
I want to separate this script in two scripts : time and date bot's.
Is is it possible ?

C??o?y??  ==>> +1 karma :)
I need 6 Gold Stars and 666 Karma Pluses !!!
I'm just starting with PtokaX and LUA :) Don't castigate me :)

Cêñoßy†ê

Quote from: ResidentEvil on 28 March, 2008, 16:07:08
I want to separate this script in two scripts : time and date bot's.
Is is it possible ?

C??o?y??  ==>> +1 karma :)

File updated with your request ;)
Powered By Leviathan™ 2nd Generation v. 1.9

ResidentEvil

   Core.RegBot(os.date("?[%H.%M]["..gmt.."]?"),description,mail,true)
   tmp = os.date("?[%H.%M]["..gmt.."]?[%d.%m.%Y]?")

Delete bolded or bot will start a new time bot every minute  :D
I need 6 Gold Stars and 666 Karma Pluses !!!
I'm just starting with PtokaX and LUA :) Don't castigate me :)

Cêñoßy†ê

 :o Sorry was my mistake (happens when you do something little to fast) thx for reporting it  ::)
Bug fixed in first post
Powered By Leviathan™ 2nd Generation v. 1.9

ResidentEvil

And a little advice. Change TmrMan.AddTimer(1*60000) to time period to 1000 ~ 5000ms, cause when bot starts for example at 9min 59 seconds, time in few seconds is 10 min, but bot still show's 9 min (bot drop's behind in 59 seconds)
I need 6 Gold Stars and 666 Karma Pluses !!!
I'm just starting with PtokaX and LUA :) Don't castigate me :)

SMF spam blocked by CleanTalk