This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

clock

Help for those learning Tcl or writing their own scripts.
p
pektek
Halfop
Posts: 55
Joined: Sat Jul 01, 2023 4:51 pm

Re: clock

Post by pektek »

2 minutes expire, privmsg does not show on the channel CrazyCat

Thank you for your help :wink:
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: clock

Post by CrazyCat »

The last script I gave works like a charm, did you think to do .chanset #channel +sharetime ?

If you want to check: ircs://irc.zeolia.chat/test :
10:32:02 <@Jarvis> Senin Maret 18 2024 -- 05:32:00 PM
10:34:02 <@Jarvis> Senin Maret 18 2024 -- 05:34:00 PM
p
pektek
Halfop
Posts: 55
Joined: Sat Jul 01, 2023 4:51 pm

Re: clock

Post by pektek »

Thank you CrazyCat 8)
User avatar
abah
Halfop
Posts: 70
Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia

Re: clock

Post by abah »

abi wrote: Mon Feb 12, 2024 1:37 am
########################
#      ShareTime       #     
# -------------------  #
#   Date: 25-01-2018   #
#   Version: v0.6      #
#   Author(s): wie     #
########################

set sharetime(format) "%A %B %d %Y -- %H:%M:%S"
bind time - "00 * * * *" sharetime
bind pubm - *jam* sharetime_pub

setudef flag sharetime

proc sharetime {nick uhost hand chan arg} {
	global sharetime waktu
	foreach chan [channels] {
		if {[channel get $chan sharetime]} {
			replacetime
			puthelp "PRIVMSG $chan :$waktu"
		}
	}
}

proc sharetime_pub {nick uhost hand chan arg} {
	global sharetime otime waktu 
	set rtime [unixtime]
	if { $rtime - $otime  > 15} {
		replacetime
		puthelp "PRIVMSG $chan :$waktu"
		set otime $rtime
	}
}
set otime 0

proc replacetime { } {
global sharetime waktu
set arguments [clock format [clock seconds] -timezone :Asia/Makassar -format $sharetime(format)]
	set day [lindex [split $arguments] 0]
	if {$day == "Monday"} { set hari "\00312Senin\003" }
	if {$day == "Tuesday"} { set hari "\00312Selasa\003" }
	if {$day == "Wednesday"} { set hari "\00312Rabu\003" }
	if {$day == "Thursday"} { set hari "\00312Kamis\003" }
	if {$day == "Friday"} { set hari "\00303Jum'at\003" }
	if {$day == "Saturday"} { set hari "\00304Sabtu\003" }
	if {$day == "Sunday"} { set hari "\00304Ahad\003" }
	set tanggal [lindex [split $arguments] 2]
	set month [lindex [split $arguments] 1]
	if {$month == "January"} { set bulan "\00312Januari\003" }
	if {$month == "February"} { set bulan "\00313Februari\003" }
	if {$month == "March"} { set bulan "\00331Maret\003" }
	if {$month == "April"} { set bulan "\00303April\003" }
	if {$month == "May"} { set bulan "\00320Mei\003" }
	if {$month == "June"} { set bulan "\00325Juni\003" }
	if {$month == "July"} { set bulan "\00337Juli\003" }
	if {$month == "August"} { set bulan "\00304Agustus\003" }
	if {$month == "September"} { set bulan "\00309September\003" }
	if {$month == "October"} { set bulan "\00310Oktober\003" }
	if {$month == "November"} { set bulan "\00322November\003" }
	if {$month == "December"} { set bulan "\00304Desember\003" }
	set tahun [lindex [split $arguments] 3]
	set jam [lindex [split $arguments] 5]

	set waktu "Hari $hari, Tanggal64 $tanggal $bulan55 $tahun, Jam12 $jam WITA"
}

putlog "\002SHARETIME:\002 ShareTime.tcl 0.6 by wie is loaded."
Can this script be made into AM or PM time?
if i put word

Code: Select all

set waktu "Hari $hari, Tanggal64 $tanggal $bulan55 $tahun, Jam12 $jam PM WITA"
does it change automatically to AM?
abah - Kota Makassar - Indonesia
Post Reply