PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: ???883?? on 02 October, 2004, 17:48:05

Title: Time script/bot
Post by: ???883?? on 02 October, 2004, 17:48:05
I have seen a bot in a hub, that tells the time, it is always at the top of the users list n has a key, the time also changes, i do hav a screenshot of this script/bot in action & the hub addy, but not sure if ur allowed to addy on here so i wont, ive been told that kepp made it, if ne1 has any info or you have it, please will u let me know, thanx, ???883??
Title:
Post by: Psycho_Chihuahua on 02 October, 2004, 18:06:37
cant remember where i got this one


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
--------------------------------------------------------
Title:
Post by: enema on 02 October, 2004, 18:09:12
yeppp, found it
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
--------------------------------------------------------
 
Title: LLLoooLLL
Post by: enema on 02 October, 2004, 18:10:22
Didnt noticed, that this post is already answered... I need glasses :D
Title:
Post by: ???883?? on 02 October, 2004, 18:25:54
Thanx ever so much, i didnt expect a reply so quick  :D ,  8)
Title:
Post by: Psycho_Chihuahua on 02 October, 2004, 19:14:35
QuoteOriginally posted by enema
Didnt noticed, that this post is already answered... I need glasses :D

He he well i got it in first m8

but what a coincedence that both of us posted exactly the same  :D
Title:
Post by: enema on 02 October, 2004, 19:23:30
I kept this thread open while searhing for script in other window. So the thread couldnt get refreshed :) Well, I found this script in this forum by using search. I found it, tested it, I realised, that I like this clock and then posted it here... hahaahaa... so i didnt noticed, that somebody posted same thing... well, s*it happens!

still laughing..
Title:
Post by: DARELL on 02 October, 2004, 23:10:26
iInterval = 60; -- in minutes
sBotName = "opunia";

iState = 0;

function Main()
  iState = 2;
  SetTimer(60 * 1000);
  StartTimer();
end

function OnTimer()
  if (iState == 1) then
    SendToAll(sBotName, "text"..date("%H:%M").."text");
  elseif (iState == 2 and mod(date("%M") + iInterval, iInterval) == 0) then
    SetTimer(iInterval * 60 * 1000);
    iState = 1;
    SendToAll(sBotName, "text"..date("%H:%M").."text");
  end
end

function GetDate()
   d = date("%d")
   mm = date("%m")
   y = date("%y")
   Date = ""..d.."/"..mm.."/"..y
   return Date
end
Title: Nice one,
Post by: enema on 03 October, 2004, 08:07:14
... But Im afraid it isint what ???883?? was looking for. Take a look at script above, you will see, that they work completely different. Thanks anyway :)
Title:
Post by: BoJlk on 06 October, 2004, 03:49:46
Can anyone check why i'm getting another Bot
after "Restart Scripts"

And i did restarted my client!

The only way to restore it was Restarting the HUB
and that's out of the question!
Title:
Post by: Psycho_Chihuahua on 06 October, 2004, 06:25:32
depends which script your talking about

I'v restarted my scripts many times and always havebut 1 timbot in the hub



otherwise use this
-- BotMgr 1.0
-- by Mutor
--
-- Add / Remove bot names from user list.
-- Option for context menu [you can add more of your own commands]
-- Allow command by profile
--
-- Remove/Restore a bot by typing [in main chat]
-- !killbot --Removes bot
-- !listbot --Restores bot
-- Bot will be listed if scripts are restarted as well
--
--
aprof = 0 -- Masters are authorized to use these commands
SendMenu = "1" -- Provide context [right click] menu commands, 0 for no
--


function NewUserConnected(user)
if SendMenu == "1" then
if user.iProfile == aprof then
customCMDS(user)
user:SendData(" *** Notice :: Right click hub tab or user list for Admin commands. ***")
else
end
else
end
end

OpConnected = NewUserConnected

--$UserCommand 1 X  Where -> 1=Hub Menu 2=User Menu 3=Hub/User Menu
function customCMDS(user)
--user:SendData("$UserCommand 255 7") --clear the menu first
user:SendData("$UserCommand 1 3 [Admin]\\Remove Bot $<%[mynick]> !killbot %[line:BotNick]||")
user:SendData("$UserCommand 1 3 [Admin]\\Restore Bot $<%[mynick]> !listbot %[line:BotNick]||")
end

function DataArrival(user, data)
if user.iProfile == aprof then
if strsub(data,1,1)=="<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,name = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
if cmd=="!killbot" then
frmHub:UnregBot(name)
elseif cmd=="!listbot" then
frmHub:RegBot(name)
end
end
end
end
Title:
Post by: Typhoon on 06 October, 2004, 11:45:18
can also deppend on what PtokaX verison you are using , the " OnExit() " part is only available in the beta versions. that's why it don't unreg the bot upon restart scripts ...


Typhoon?
Title:
Post by: BoJlk on 06 October, 2004, 12:37:00
i'm using [ProtaX v0.326 TD4]
And when i got the three BOTs the time was different
in each of them (the interval of the time i've restarted)
Title:
Post by: Typhoon on 06 October, 2004, 13:09:34
current = date("%H:%M")
min = 1000*60

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

try this out it should do the same


Typhoon?
Title:
Post by: BoJlk on 07 October, 2004, 00:30:31
Typhoon?
Can you add Date?
Title:
Post by: Typhoon on 07 October, 2004, 00:55:26
current = date("  %X -- %d/%m-%Y")
min = 1000*60

--------------------------------------------------------
function Main()
                frmHub:UnregBot("---" ..current .."---")
frmHub:RegBot("---" ..current .."---")
SetTimer(min)
StartTimer()
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot("---" ..current .."---")
time = date("  %X -- %d/%m-%Y")
current = time
frmHub:RegBot("---" ..current .."---")
end
--------------------------------------------------------

that should do it ..


Typhoon?
Title:
Post by: BoJlk on 07 October, 2004, 02:38:58
hehe...That was quick!
10x Typhoon?

Can you change it and make it without a second?!
Title:
Post by: Typhoon on 08 October, 2004, 09:05:41
current = date("%H:%M -- %d/%m-%Y")
min = 1000*60

--------------------------------------------------------
function Main()
                frmHub:UnregBot("---" ..current .."---")
frmHub:RegBot("---" ..current .."---")
SetTimer(min)
StartTimer()
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot("---" ..current .."---")
time = date("%H:%M -- %d/%m-%Y")
current = time
frmHub:RegBot("---" ..current .."---")
end
--------------------------------------------------------

here you go..


Typhoon?