PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Psycho_Chihuahua on 15 March, 2005, 17:27:07

Title: help with time script
Post by: Psycho_Chihuahua on 15 March, 2005, 17:27:07
Could someone help me out here?

current = os.date("%d:%m:%y - %H:%M")
iMin = 1000*60

function Main()
current = os.date("%d:%m:%y - %H:%M")
if tTime[current] then
SendToAll( ("---" ..current .."---"), tTime[current] )
end
frmHub:RegBot("---" ..current .."---")
SetTimer(iMin)
StartTimer()
end
function OnTimer()
frmHub:UnregBot("---" ..current .."---")
current = os.date("%d:%m:%y - %H:%M")
if tTime[current] then
SendToAll( ("---" ..current .."---"), tTime[current] )
end
frmHub:RegBot("---" ..current .."---")
end
function OnExit()
frmHub:UnregBot("---" ..current .."---")
end

I had it working with the newer Version of Ptx (16.03/16.04/16.05) but now with 16.06 it don't work
Title:
Post by: Herodes on 15 March, 2005, 17:35:21
Maybe this could work .. current = os.date("%d:%m:%y - %H:%M")
iMin = 1000*60

function Main()
current = os.date("%d:%m:%y - %H:%M")
SendToAll( ("*** Time now is ---" ..current .."---") )
frmHub:RegBot("---" ..current .."---", 1, "", "")
SetTimer(iMin)
StartTimer()
end

function OnTimer()
frmHub:UnregBot("---" ..current .."---")
current = os.date("%d:%m:%y - %H:%M")
SendToAll( ("*** Time now is ---" ..current .."---") )
frmHub:RegBot("---" ..current .."---", 1, "", "")
end

function OnExit()
frmHub:UnregBot("---" ..current .."---")
end
Title:
Post by: Psycho_Chihuahua on 15 March, 2005, 17:41:57
Thnx Herodes, partialy works - just the "dummy User" doesn't appear  :(  is it possible to get that part working as well?
Title:
Post by: Herodes on 15 March, 2005, 17:45:49
QuoteOriginally posted by Psycho_Chihuahua
Thnx Herodes, partialy works - just the "dummy User" doesn't appear  :(  is it possible to get that part working as well?
Could be working now .. above post edited ... I am guessing the mistake is coming from the new way PtokaX is ReggingBots ... the frmHub:RegBot() needs some additional arguments ( botname, oper, description, email )...
Title:
Post by: Psycho_Chihuahua on 15 March, 2005, 17:54:48
no - still not working  ;(
Title:
Post by: Herodes on 15 March, 2005, 18:18:20
QuoteOriginally posted by Psycho_Chihuahua
no - still not working  ;(
Found it .. Nothing to do with Lua itself ... it was the invalid characters for nicknames that the newest PtokaX has .. it was the ':' screwing the whole thing up .. there you go with a working thing ..
current = ""
iMin = 1000*60

function Main()
current = os.date("%d-%m-%y - %H.%M")
SendToAll( "*** Time now is @ -=".. current.."=-" )
frmHub:RegBot( "-=".. current.."=-" , 1, "", "")
SetTimer(iMin)
StartTimer()
end

function OnTimer()
frmHub:UnregBot( "-=" ..current .."=-" )
current = os.date("%d-%m-%y - %H.%M")
SendToAll( "*** Time now is @ -=".. current.."=-" )
frmHub:RegBot( "-=".. current.."=-" , 1, "", "")
end

function OnExit()
frmHub:UnregBot( ("-=" ..current .."=-") )
end
Title:
Post by: BeeR on 15 March, 2005, 19:20:23
HI ,,
this timebot seems to send the time every min ,,
maybe i have to little beer in my head or i'm stupid ,,
i cannot change timevalue (120 min)

[19:19:20] ?? Dagens datum & tid ?r nu: 15-03-05 - 19.19 ??
[19:20:20] ?? Dagens datum & tid ?r nu: 15-03-05 - 19.20 ??
[19:21:20] ?? Dagens datum & tid ?r nu: 15-03-05 - 19.21 ??
Title:
Post by: Psycho_Chihuahua on 15 March, 2005, 19:25:53
I actually only want it to show a "Dummy User" in the Userlist that shows the Time - which it still doesn't  ;(  ;(
Title:
Post by: Jelf on 15 March, 2005, 20:15:15
Check here for original Timebot

http://www.wooshman.ath.cx/ (http://www.wooshman.ath.cx/)
Title:
Post by: Psycho_Chihuahua on 15 March, 2005, 20:42:25
I've seen and tried that one already, but with Ptokax 16.06 it doesnt work  ;(
Title:
Post by: plop on 15 March, 2005, 21:27:30
tested and wasting bandwidth so yes it works.
localtime = {
sec = "1",
Description = "local time bot",
Email = "some email addy",
}

function Time()
   local current = os.date("%H.%M.%S")
   localtime.botname = "-=" ..current .."=-"
end

--------------------------------------------------------
function Main()
   Time()
   frmHub:RegBot(localtime.botname, 1, localtime.Description, localtime.Email)
   SetTimer(localtime.sec * 1000)
   StartTimer()
end
--------------------------------------------------------
function OnTimer()
   frmHub:UnregBot(localtime.botname)
   Time()
   frmHub:RegBot(localtime.botname, 1, localtime.Description, localtime.Email)
end
--------------------------------------------------------
function OnExit()
   frmHub:UnregBot(localtime.botname)
end
any1 an idea who made the original??

plop
Title:
Post by: Psycho_Chihuahua on 15 March, 2005, 21:46:31
i think it was Whooshman, but i'm not sure


Thanks a lot for the Script Plop, after taking out the seconds and setting it on 1minute its running fine now (saving at least a bit of Bw  :D )

Here is what i now have - running fine

localtime = {
sec = "60",
Description = "lokaler Zeitbot",
Email = "helvetia@psycho-chihuahua.net",
}

function Time()
   local current = os.date("%H.%M..%d.%m.%y")
   localtime.botname = "-=" ..current .."=-"
end

--------------------------------------------------------
function Main()
   Time()
   frmHub:RegBot(localtime.botname, 1, localtime.Description, localtime.Email)
   SetTimer(localtime.sec * 1000)
   StartTimer()
end
--------------------------------------------------------
function OnTimer()
   frmHub:UnregBot(localtime.botname)
   Time()
   frmHub:RegBot(localtime.botname, 1, localtime.Description, localtime.Email)
end
--------------------------------------------------------
function OnExit()
   frmHub:UnregBot(localtime.botname)
end

showing as -=21.47..15.03.05=-