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.

HeLp , Please

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

HeLp , Please

Post by pektek »

How can we reflect this tcl time to the channel?

For example, it will be 30 minutes ?

Code: Select all

bind time - "00 *" pub_jam
bind time - "30 *" pub_jam
bind time - "* *" pub_jam1
bind pub - !date pub_tjam

##### contoh "#chansatu #chandua #chantiga"
##### biarkan kosong untuk semua channel
set chanjam ""
#####
# 1 WIB
# 2 WITA
# 3 WIT
set varTzone "2"

if {$varTzone == 1} {
	set curTzone "Asia/Jakarta"
	set varIndi "WIB"
} {
	if {$varTzone == 2} {
		set curTzone "Asia/Makassar"
		set varIndi "WITA"
	} {
		if {$varTzone == 3} {
			set curTzone "Asia/Tokyo"
			set varIndi "WIT"
		} {
			putlog "TIMEZONE SALAH"
			die
		}
	}
}

proc pub_jam1 {min h d m y} {
	global curTzone chanjam
	set jam [clock format [clock seconds] -timezone :$curTzone -format %I:%M%p]
	if {$jam == "04:14AM"} {
		if {$chanjam == ""} {
			foreach chan [channels] {
				list [pub_jam3 $chan $min $h $d $m $y]
				putserv "PRIVMSG $chan :- Waktunya Sholat Subuh"
			}
		}
		if {$chanjam != ""} {
			foreach chan [channels] {
				if {[lsearch -exact [string tolower $chanjam] [string tolower $chan]] != -1} {
					list [pub_jam3 $chan $min $h $d $m $y]
					putserv "PRIVMSG $chan :- Waktunya Sholat Subuh"
				}
			}
		}
	}
	if {$jam == "11:56AM"} {
		if {$chanjam == ""} {
			foreach chan [channels] {
				list [pub_jam3 $chan $min $h $d $m $y]
				putserv "PRIVMSG $chan :- Waktunya Sholat Dzuhur"
			}
		}
		if {$chanjam != ""} {
			foreach chan [channels] {
				if {[lsearch -exact [string tolower $chanjam] [string tolower $chan]] != -1} {
					list [pub_jam3 $chan $min $h $d $m $y]
					putserv "PRIVMSG $chan :- Waktunya Sholat Dzuhur"
				}
			}
		}
	}
	if {$jam == "03:00PM"} {
		if {$chanjam == ""} {
			foreach chan [channels] {
				putserv "PRIVMSG $chan :- Waktunya Sholat Azhar"
				#list [pub_jam3 $chan $min $h $d $m $y]
			}
		}
		if {$chanjam != ""} {
			foreach chan [channels] {
				if {[lsearch -exact [string tolower $chanjam] [string tolower $chan]] != -1} {
					putserv "PRIVMSG $chan :- Waktunya Sholat Azhar"
					#list [pub_jam3 $chan $min $h $d $m $y]
				}
			}
		}
	}
	if {$jam == "05:51PM"} {
		if {$chanjam == ""} {
			foreach chan [channels] {
				list [pub_jam3 $chan $min $h $d $m $y]
				putserv "PRIVMSG $chan :- Waktunya Sholat Maghrib"
			}
		}
		if {$chanjam != ""} {
			foreach chan [channels] {
				if {[lsearch -exact [string tolower $chanjam] [string tolower $chan]] != -1} {
					list [pub_jam3 $chan $min $h $d $m $y]
					putserv "PRIVMSG $chan :- Waktunya Sholat Maghrib"
				}
			}
		}
	}
	if {$jam == "07:07PM"} {
		if {$chanjam == ""} {
			foreach chan [channels] {
				list [pub_jam3 $chan $min $h $d $m $y]
				putserv "PRIVMSG $chan :- Waktunya Sholat Isya"
			}
		}
		if {$chanjam != ""} {
			foreach chan [channels] {
				if {[lsearch -exact [string tolower $chanjam] [string tolower $chan]] != -1} {
					list [pub_jam3 $chan $min $h $d $m $y]
					putserv "PRIVMSG $chan :- Waktunya Sholat Isya"
				}
			}
		}
	}
}

proc serandomjoke {} {
	set cukale [lindex "04 07 03 02 05 06" [rand 6]]
	return "\003$cukale"
}

proc pub_jam {min h d m y} {
	global chanjam curTzone varIndi
	set myjfor "%A %I:%M\003%p \x1d$varIndi\x1d %A"
	set warnabaru [serandomjoke]
	set jam [clock format [clock seconds] -timezone :$curTzone -format $myjfor]
	set jamtes [clock format [clock seconds] -timezone :$curTzone -format %I:%M%p]
	set newjam $jam
	regsub -all {0} $newjam "\uff10" newjam
	regsub -all {1} $newjam "\uff11" newjam
	regsub -all {2} $newjam "\uff12" newjam
	regsub -all {3} $newjam "\uff13" newjam
	regsub -all {4} $newjam "\uff14" newjam
	regsub -all {5} $newjam "\uff15" newjam
	regsub -all {6} $newjam "\uff16" newjam
	regsub -all {7} $newjam "\uff17" newjam
	regsub -all {8} $newjam "\uff18" newjam
	regsub -all {9} $newjam "\uff19" newjam
	regsub -all {PM} $newjam "\u1d3e\u1d39" newjam
	regsub -all {AM} $newjam "\u1d2c\u1d39" newjam
    regsub -all {Sunday} $newjam "\00304\u1d50\u2071\u207f\u1d4d\u1d4d\u1d58\003$warnabaru" newjam
    regsub -all {Monday} $newjam "\00303\u02e2\u1d49\u207f\u2071\u207f\003$warnabaru" newjam
    regsub -all {Tuesday} $newjam "\00303\u02e2\u1d49\u02e1\u1d43\u02e2\u1d43\003$warnabaru" newjam
    regsub -all {Wednesday} $newjam "\00303\u02b3\u1d43\u1d47\u1d58\003$warnabaru" newjam
    regsub -all {Thursday} $newjam "\00303\u1d4f\u1d43\u1d50\u2071\u02e2\003$warnabaru" newjam
    regsub -all {Friday} $newjam "\00303\u02b2\u1d58\u1d50\u1d43\u1d57\003$warnabaru" newjam
    regsub -all {Saturday} $newjam "\00303\u02e2\u1d43\u1d47\u1d57\u1d58\003$warnabaru" newjam
	#putserv "PRIVMSG #zz :$jampost 1"
	foreach chan [channels] {
		if {$chanjam == ""} {
			putserv "PRIVMSG $chan :\003$warnabaru\[\00301$newjam\003$warnabaru\]\00301"
			if {$jamtes == "12:00AM"} {
				list [sohari $chan]
			}
		}
		if {$chanjam != ""} {
			if {[lsearch -exact [string tolower $chanjam] [string tolower $chan]] != -1} {
				putserv "PRIVMSG $chan :\003$warnabaru\[\00301$newjam\003$warnabaru\]\00301"
				if {$jamtes == "12:00AM"} {
					list [sohari $chan]
				}
			}
		}
	}
}

proc pub_jam3 {chan min h d m y} {
	global chanjam curTzone varIndi
	set myjfor "%A %I:%M\003%p \x1d$varIndi\x1d %A"
	set warnabaru [serandomjoke]
	set jam [clock format [clock seconds] -timezone :$curTzone -format $myjfor]
	set jamtes [clock format [clock seconds] -timezone :$curTzone -format %I:%M%p]
	set newjam $jam
	regsub -all {0} $newjam "\uff10" newjam
	regsub -all {1} $newjam "\uff11" newjam
	regsub -all {2} $newjam "\uff12" newjam
	regsub -all {3} $newjam "\uff13" newjam
	regsub -all {4} $newjam "\uff14" newjam
	regsub -all {5} $newjam "\uff15" newjam
	regsub -all {6} $newjam "\uff16" newjam
	regsub -all {7} $newjam "\uff17" newjam
	regsub -all {8} $newjam "\uff18" newjam
	regsub -all {9} $newjam "\uff19" newjam
	regsub -all {PM} $newjam "\u1d3e\u1d39" newjam
	regsub -all {AM} $newjam "\u1d2c\u1d39" newjam
    regsub -all {Sunday} $newjam "\00304\u1d50\u2071\u207f\u1d4d\u1d4d\u1d58\003$warnabaru" newjam
    regsub -all {Monday} $newjam "\00303\u02e2\u1d49\u207f\u2071\u207f\003$warnabaru" newjam
    regsub -all {Tuesday} $newjam "\00303\u02e2\u1d49\u02e1\u1d43\u02e2\u1d43\003$warnabaru" newjam
    regsub -all {Wednesday} $newjam "\00303\u02b3\u1d43\u1d47\u1d58\003$warnabaru" newjam
    regsub -all {Thursday} $newjam "\00303\u1d4f\u1d43\u1d50\u2071\u02e2\003$warnabaru" newjam
    regsub -all {Friday} $newjam "\00303\u02b2\u1d58\u1d50\u1d43\u1d57\003$warnabaru" newjam
    regsub -all {Saturday} $newjam "\00303\u02e2\u1d43\u1d47\u1d57\u1d58\003$warnabaru" newjam
	putserv "PRIVMSG $chan :\003$warnabaru\[\00301$newjam\003$warnabaru\]\00301"
}

proc sohari {chan} {
	global curTzone
	set jam1 "Sekarang sudah hari [clock format [clock seconds] -timezone :$curTzone -format %A]"
	regsub -all {Sunday} $jam1 "\00304Minggu\003" jam1
	regsub -all {Monday} $jam1 "\00303Senin\003" jam1
	regsub -all {Tuesday} $jam1 "\00303Selasa\003" jam1
	regsub -all {Wednesday} $jam1 "\00303Rabu\003" jam1
	regsub -all {Thursday} $jam1 "\00303Kamis\003" jam1
	regsub -all {Friday} $jam1 "\00303Jumat\003" jam1
	regsub -all {Saturday} $jam1 "\00303Sabtu\003" jam1
	putserv "PRIVMSG $chan :$jam1"
}

proc pub_tjam {nick host hand chan text} {
	global curTzone varIndi
	set varjfor "%A, %I:%M %p $varIndi. %d %B %Y"
	#set varjfor "%I:%M %p"
	set varJam1 [clock format [clock seconds] -timezone :$curTzone -format $varjfor]
    regsub -all {Sunday} $varJam1 "\00304Minggu\003" varJam1
    regsub -all {Monday} $varJam1 "\00303Senin\003" varJam1
    regsub -all {Tuesday} $varJam1 "\00303Selasa\003" varJam1
    regsub -all {Wednesday} $varJam1 "\00303Rabu\003" varJam1
    regsub -all {Thursday} $varJam1 "\00303Kamis\003" varJam1
    regsub -all {Friday} $varJam1 "\00303Jumat\003" varJam1
    regsub -all {Saturday} $varJam1 "\00303Sabtu\003" varJam1
    regsub -all {January} $varJam1 "\00305Januari\003" varJam1
    regsub -all {February} $varJam1 "\00313Februari\003" varJam1
    regsub -all {March} $varJam1 "\00302Maret\003" varJam1
    regsub -all {April} $varJam1 "\00310April\003" varJam1
    regsub -all {May} $varJam1 "\00314Mei\003" varJam1
    regsub -all {June} $varJam1 "\00308Juni\003" varJam1
    regsub -all {July} $varJam1 "\00307Juli\003" varJam1
    regsub -all {August} $varJam1 "\00311Agustus\003" varJam1
    regsub -all {September} $varJam1 "\00304September\003" varJam1
    regsub -all {October} $varJam1 "\00309Oktober\003" varJam1
    regsub -all {November} $varJam1 "\00313November\003" varJam1
    regsub -all {December} $varJam1 "\00303Desember\003" varJam1
	putserv "PRIVMSG $chan :$varJam1"
}

putlog "clock.tcl           write_ by KocHi (uKi`) -: LoadeD :-"
User avatar
CrazyCat
Revered One
Posts: 1296
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: HeLp , Please

Post by CrazyCat »

I don't understand your question.
User avatar
aslpls
Halfop
Posts: 45
Joined: Mon May 02, 2016 9:41 am

Re: HeLp , Please

Post by aslpls »

Code: Select all

bind time - "30 *" pub_jam
i think, this is the timer to show/post in the channel

Code: Select all

<Bot> [ˢᵃᵇᵗᵘ 04:30ᴾᴹ WIB ˢᵃᵇᵗᵘ]
<Bot> [ˢᵃᵇᵗᵘ 05:00ᴾᴹ WIB ˢᵃᵇᵗᵘ]
<Bot> [ˢᵃᵇᵗᵘ 05:30ᴾᴹ WIB ˢᵃᵇᵗᵘ]
<Bot> [ˢᵃᵇᵗᵘ 05:51ᴾᴹ WIB ˢᵃᵇᵗᵘ]
<Bot> - Waktunya Sholat Maghrib
<Bot> [ˢᵃᵇᵗᵘ 06:00ᴾᴹ WIB ˢᵃᵇᵗᵘ]
<Bot> [ˢᵃᵇᵗᵘ 06:30ᴾᴹ WIB ˢᵃᵇᵗᵘ]
<Bot> [ˢᵃᵇᵗᵘ 07:00ᴾᴹ WIB ˢᵃᵇᵗᵘ]
this is the live example.
It was FUNNY!
p
pektek
Halfop
Posts: 50
Joined: Sat Jul 01, 2023 4:51 pm

Re: HeLp , Please

Post by pektek »

Crazycat is what I want. Add time to tcl. Telling the channel at this time
Post Reply