Author Topic: Current time as Bot [API2]  (Read 3347 times)

0 Members and 1 Guest are viewing this topic.

Offline Cêñoßy†ê

  • Scripter
  • Triple Ace
  • ******
  • Posts: 190
  • Karma: +31/-3
Current time as Bot [API2]
« on: 28 March, 2008, 14:44:17 »
Code: [Select]
--[[
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
« Last Edit: 28 March, 2008, 16:43:52 by C??o?y? »
***********************
Powered By Leviathan v5.2 ;)

PtokaX forum

Current time as Bot [API2]
« on: 28 March, 2008, 14:44:17 »

Offline ResidentEvil

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-3
Re: Current time as Bot [API2]
« Reply #1 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 :)
« Last Edit: 28 March, 2008, 16:11:27 by ResidentEvil »
I need 6 Gold Stars and 666 Karma Pluses !!!
I'm just starting with PtokaX and LUA :) Don't castigate me :)

Offline Cêñoßy†ê

  • Scripter
  • Triple Ace
  • ******
  • Posts: 190
  • Karma: +31/-3
Re: Current time as Bot [API2]
« Reply #2 on: 28 March, 2008, 16:26:13 »
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 v5.2 ;)

Offline ResidentEvil

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-3
Re: Current time as Bot [API2]
« Reply #3 on: 28 March, 2008, 16:36:25 »
   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 :)

Offline Cêñoßy†ê

  • Scripter
  • Triple Ace
  • ******
  • Posts: 190
  • Karma: +31/-3
Re: Current time as Bot [API2]
« Reply #4 on: 28 March, 2008, 16:45:04 »
 :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 v5.2 ;)

Offline ResidentEvil

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-3
Re: Current time as Bot [API2]
« Reply #5 on: 30 March, 2008, 03:47:30 »
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 :)

PtokaX forum

Re: Current time as Bot [API2]
« Reply #5 on: 30 March, 2008, 03:47:30 »