help with time script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

help with time script

Started by Psycho_Chihuahua, 15 March, 2005, 17:27:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Psycho_Chihuahua

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
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

#1
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

Psycho_Chihuahua

Thnx Herodes, partialy works - just the "dummy User" doesn't appear  :(  is it possible to get that part working as well?
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

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 )...

Psycho_Chihuahua

no - still not working  ;(
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

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

BeeR

#6
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 ??
A cold BeeR is stunning !!

Psycho_Chihuahua

#7
I actually only want it to show a "Dummy User" in the Userlist that shows the Time - which it still doesn't  ;(  ;(
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Jelf


Psycho_Chihuahua

I've seen and tried that one already, but with Ptokax 16.06 it doesnt work  ;(
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Psycho_Chihuahua

#11
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=-
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

SMF spam blocked by CleanTalk