![]() |
|
|||||||
| Tcl scripting Tcl scripting related questions |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
|
As avea cateva rugaminte la cei ce stiu tcl:
1. cand intra cineva pe HelpChan sa dea un notice pe HomeChan, 2. daca se poate sa mearga toate comenzile, ex: b nu merge ![]() 3. comenzile sa fie de forma n h b s p l Care are timp si este amabil sa imi dea o idee cum sa il fac sa functioneze. Ms Anticipat. Codul este : Code:
## ¤ .next
# version 0.1.3
# caesar <cezarica [at] prietenii [dot] com>
# #eggdrop @ Undernet.org
# http://www.r0x0ring.com/
##
# ¤ Description:
# An replica of the next TCL script that I've seen been used on #zt and #nastrand channels @ Undernet.
### ¤ Notices:
# Feel free to e-mail me if you have suggestions, bug reports, or just general feedback, etc.
# You may modify this how your hart wishes as long is for your own usage.
# If you would like to share it with others give me and the people who helped me some credit
# for the *hard* work.. :P~
#
# Use a channel limiter to prevent a botnet join/part flood;
#
### ¤ Commands:
#
# Where Flag Command Description
# ----- ---- ------- -----------
# PUB : - .next Voices the first nick in the list.
# - .helped Removes the "voice" and send a notice to leave the
# channel, after he/she had been helped.
# - .noidle Kick/ban 1 minute "nick" for being idle/ away while
# in channel.
# - .skip Removes "nick" from the list. very useful when is a
# friend, and/ or a bot who changed his host or
# something like this.
# - .put Adds "nick" in to the list, if for some reason
# "nick" isn't there.
# - .list You will receive an notice with the "nicks" that are
# in his voice list.
#
# MSG : N/A
#
# DCC : n|n .chanset Use .chanset to set the script active for the particular channel or not.
# Example: .chanset #abc123 +next
# .chanset #abc123 -next
#
### ¤ Instalation:
# Edit and change the settings for your channel as it suits you better after that, .rehash your bot.
#
### ¤ Many thanks:
# o ppslim for helping me out with some small problems;
# o MC_8 for the More Tools quick procs, tips and sugestions;
# o egghead for the tips and sugestions;
# o slennox and forum.egghelp.org members for the posts and replyes;
# o ShoX for poiting the remove on op/voice from others;
#
### ¤ And special thanks for the feedback on the bugs goes to:
# o lsn @ Undernet for the feedback on the skip problem;
# o FBI_Agent @ Undernet for the feedback on the missing queue:* for channels;
# o OmnitroN @ Undernet for the feedback on the 'known user' problem.
# o aqwzsx @ Undernet for the feedback on the *split* and list problem
# o sprite @ Undernet for the feedback on the next(noidle) message problem.
# 1. Do you wish to voice helpers upon joining the channel? Set this to 1, else set it to 0.
set next(voice) 1
# 2. What flag the helper should have to be able to use the public commands?
set next(flag) "-|g"
# 3. Se the char type you want
set next(char) ""
# 4. How long, in minutes, do you want the .noidle ban to last?
set next(time) 10
# 5. Set this to 0 if you want to be a ban in the bot, else set it to 1 for a server ban (ban set on the channel).
set next(type) 1
# 6. Custromize the messages:
set next(welcome) { Please wait for your turn as we are busy right now. You will be voiced\
automaticly when we finish with the current guests. You are number \002$position\002\
in line. Thank You. | Te rog sa astepti pentru ca suntem ocupati in momentul de fata. Vei\
primi voice de indata ce terminam cu vizitatorii actuali. Esti numarul \002$position\002\
in linie.
}
set next(helped) { As per $nick, you have been helped. Now, please leave $chan and if you still\
have more questions just cycle the channel.
}
set next(next) { After waiting $duration you will be assisted now by $nick. Please STATE\
your question in $chan channel. | Dupa ce ai asteptat $duration vei fi asistat de $nick.\
Spune problema pe canalul $chan.
}
set next(noidle) { Don't idle in $chan channel please. \002$next(time)\002 minute\[expr {$next(time)==1?"":"s"}] /Pls Don`t IDLE Please \037\002do not IDLE\002\037 on $chan. Tempban \00210\002 minutes. }
# 7. If you want shorter or different commands rather that the *default* ones change below:
set next(cmd) "n h b s p l"
#
## ¤ Don't edit past here unless you know WTF you are doing! ¤
#
set next(version) "1.0"
setudef flag next
# quick cleanup
foreach binding [binds] {
if {![string match -nocase "*next:*" [set name [lindex $binding 4]]]} {
continue
}
unbind [lindex $binding 0] [lindex $binding 1] [lindex $binding 2] $name
}
bind join - * next:add
bind part - * next:del
bind sign - * next:del
bind nick - * next:nick
bind kick - * next:kick
bind mode - * next:mode
# commands
set next(default) "voice helped noidle skip put list" ; set i 0
foreach cmd [split $next(cmd)] {
set proc [lindex $next(default) $i]
bind pub $next(flag) $next(char)$cmd next:$proc
incr i
}
# queue fix
set next(active) ""
foreach chan [channels] {
if {[channel get $chan next]} {
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
lappend next(active) $chan
}
}
# join
proc next:add {nick uhost hand chan} {
global next settings
if {![channel get $chan next] || ![botisop $chan]} {
return
}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
if {[isbotnick $nick]} {
next:update $chan
return
}
if {[matchattr $hand $next(flag) $chan] && $next(voice)} {
pushmode $chan +v $nick
flushmode $chan
return
}
if {[lsearch $next(queue:$chan) "*:$uhost:*"] == -1} {
lappend next(queue:$chan) "$nick:$uhost:[clock seconds]"
set position [llength $next(queue:$chan)]
putserv "NOTICE $nick :[subst -noc $next(welcome)]"
putserv "NOTICE $settings(homechan) :Baaa!!! Asteapta cineva pe $chan esti chior ?!?! Treci si ajuta-l!"
}
}
# update
proc next:update {chan} {
global next
if {![llength $next(queue:$chan)]} {
return
}
foreach user $next(queue:$chan) {
if {[onchan $user $chan]} {
lappend updated $user
}
}
if {[info exists updated]} {
set next(queue:$chan) $updated
}
}
# part/sign
proc next:del {nick uhost hand chan {text ""}} {
next:remove $nick $uhost $chan
}
# kick
proc next:kick {nick uhost hand chan victim reason} {
next:remove $victim [getchanhost $victim $chan] $chan
}
# nick
proc next:nick {nick uhost handle chan newnick} {
global next
if {[isbotnick $nick] || ![channel get $chan next]} {
return
}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
if {[set position [lsearch $next(queue:$chan) "*:$uhost:*"]] != -1} {
set tmp [join [lreplace [split [lindex $next(queue:$chan) $position] :] 0 0 $newnick] :]
set next(queue:$chan) [lreplace $next(queue:$chan) $position $position $tmp]
}
}
# mode
proc next:mode {nick uhost hand chan mode victim} {
if {![channel get $chan next] || [isbotnick $victim]} {
return
}
next:purge [getchanhost $victim $chan] $chan
}
# remove
proc next:remove {nick uhost chan} {
global next
if {![channel get $chan next] || [isbotnick $nick] || ![botisop $chan]} {
return
}
next:purge $uhost $chan
}
# purge
proc next:purge {uhost chan} {
global next
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
if {[set position [lsearch $next(queue:$chan) "*:$uhost:*"]] != -1} {
set next(queue:$chan) [lreplace $next(queue:$chan) $position $position]
}
}
# voice
proc next:voice {nick uhost hand chan text} {
global next
if {![channel get $chan next]} {
return
}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
if {$next(queue:$chan) == ""} {
putserv "NOTICE $nick :No one currently awaiting help."
return
}
if {![botisop $chan]} {
putserv "NOTICE $nick :I cannot proceed, I'm not opped."
return
}
set voice [lindex [split [lindex $next(queue:$chan) 0] :] 0]
putserv "MODE $chan +v $voice"
set duration [duration [expr [clock seconds] - [lindex [split [lindex $next(queue:$chan) 0] :] end]]]
putserv "NOTICE $voice :[subst -noc $next(next)]"
next:purge [getchanhost $voice $chan] $chan
}
# helped
proc next:helped {nick uhost hand chan text} {
global next
if {![channel get $chan next]} {
return
}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
if {[set helped [lindex [split $text] 0]] == ""} {
putserv "NOTICE $nick :\002Usage:\002 .helped <nick>"
} elseif {[isbotnick $helped]} {
putserv "NOTICE $nick :You helped me? I think not."
} elseif {![botisop $chan]} {
putserv "NOTICE $nick :I'm not opped, cannot proceed."
} elseif {![onchan $helped $chan]} {
putserv "NOTICE $nick :Where do you see $helped?"
} elseif {[lsearch $next(queue:$chan) "*:[getchanhost $helped]:*"] != -1} {
putserv "NOTICE $nick :$helped is awaiting help.. *pssh*"
} elseif {[validuser [set hand [nick2hand $helped]]] && [matchattr $hand $next(flag) $chan]} {
putserv "NOTICE $nick :$helped is a valid user, will not proceed."
} elseif {![isvoice $helped $chan]} {
putserv "NOTICE $nick :$helped is not voiced, cannot proceed."
} elseif {[isop $helped $chan]} {
putserv "NOTICE $nick :$helped is an op, will not proceed."
} else {
putserv "MODE $chan -v $helped"
putserv "NOTICE $helped :[subst -noc $next(helped)]"
next:purge [getchanhost $helped $chan] $chan
}
}
# noidle
proc next:noidle {nick uhost hand chan text} {
global next botname
if {![channel get $chan next]} {
return
}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
if {[set nnick [lindex [split $text] 0]] == ""} {
putserv "NOTICE $nick :\002Usage:\002 .noidle <nick>"
} elseif {[isbotnick $nnick]} {
putserv "NOTICE $nick :I cannot idle? *pssh*"
} elseif {![botisop $chan]} {
putserv "NOTICE $nick :I'm not opped, cannot proceed."
} elseif {![onchan $nnick $chan]} {
putserv "NOTICE $nick :Where do you see $nnick?"
} elseif {[lsearch $next(queue:$chan) "*:[getchanhost $nnick]:*"] != -1} {
putserv "NOTICE $nick :$nnick is awaiting help.. *pssh*"
} elseif {[validuser [set hand [nick2hand $nnick]]] && [matchattr $hand $next(flag) $chan]} {
putserv "NOTICE $nick :$nnick is a valid user, will not proceed."
} elseif {[isvoice $nnick $chan]} {
putserv "NOTICE $nick :$nnick is voiced, try '.helped $nnick' first."
} elseif {[isop $nnick $chan]} {
putserv "NOTICE $nick :$nnick is an op, will not proceed."
} else {
set banmask *!*@[lindex [split [getchanhost $nnick $chan] @] 1]
if {[string match -nocase $banmask $botname]} {
putserv "NOTICE $nick :I can't ban $nnick because $banmask matches me."
return
}
set temp(reason) [subst $next(noidle)]
if {!$next(type)} {
newchanban $chan $banmask $nick $temp(reason) $next(time)
}
putserv "MODE $chan +b $banmask"
putserv "KICK $chan $nnick $temp(reason)"
}
}
# skip
proc next:skip {nick uhost handle chan txt} {
global next
if {![channel get $chan next]} {return 0}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
set skip [lindex [split $txt] 0]
if {$skip == ""} {
putserv "NOTICE $nick :\002Usage:\002 .skip <nick>"
} elseif {![onchan $skip $chan]} {
putserv "NOTICE $nick :$skip is not on channel."
} elseif {[isbotnick $skip]} {
putserv "NOTICE $nick :You skip me? I think not."
} elseif {[lsearch $next(queue:$chan) "*:[getchanhost $skip]:*"] == -1} {
putserv "NOTICE $nick :$skip is not awaiting help."
} elseif {[validuser [set hand [nick2hand $skip]]] && [matchattr $hand $next(flag) $chan]} {
putserv "NOTICE $nick :$skip is a valid user, will not proceed."
} else {
putserv "NOTICE $nick :$skip has been removed from the help queue."
next:purge [getchanhost $skip $chan] $chan
}
}
# put
proc next:put {nick uhost handle chan txt} {
global next
if {![channel get $chan next]} {
return
}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
set put [lindex [split $txt] 0]
if {$put == ""} {
putserv "NOTICE $nick :\002Usage:\002 .put <nick>"
} elseif {[isbotnick $put]} {
putserv "NOTICE $nick :I need help? I think not."
} elseif {![onchan $put $chan]} {
putserv "NOTICE $nick :I don't see $put on the channel."
} elseif {[isvoice $put $chan]} {
putserv "NOTICE $nick :$put already has voice."
} elseif {[isop $put $chan]} {
putserv "NOTICE $nick :$put is an op."
} elseif {[lsearch $next(queue:$chan) "*:[getchanhost $put]:*"] != -1} {
putserv "NOTICE $nick :$put is allready in the queue."
} elseif {[validuser [set hand [nick2hand $put]]] && [matchattr $hand $next(flag) $chan]} {
putserv "NOTICE $nick :$put is a valid user of the bot, not adding."
} else {
lappend next(queue:$chan) "$put:[getchanhost $put $chan]:[clock seconds]"
putserv "NOTICE $nick :$put has been added to the queue."
set position [llength $next(queue:$chan)]
putserv "NOTICE $put :[subst -noc $next(welcome)]"
}
}
# list
proc next:list {nick uhost handle chan txt} {
global next
if {![channel get $chan next]} {
return
}
if {![info exists next(queue:$chan)]} {
set next(queue:$chan) ""
}
set temp(post) ""
foreach temp(entry) $next(queue:$chan) {
set tmp [split [lindex $temp(entry) 0] :]
set temp(duration) [duration [expr [clock seconds] - [lindex $tmp end]]]
lappend temp(post) "[lindex $tmp 0] ($temp(duration))"
}
set temp(post) [expr {($temp(post) == "")?
"currently empty.":
[join $temp(post) ", "]}]
putserv "NOTICE $nick :\002List\002: $temp(post)"
return
}
__________________
Practice Makes Perfect. |
|
|
|
|
|
#2 (permalink) | |
|
Junior Member
|
linia 161:
Code:
set temp(list)[list next voice helped "" noidle "" skip "" put "" list ""] Code:
set temp(list)[list n v h "" b "" s "" p "" l ""] Code:
bind pub $next(flag) .$temp(1) next:$temp(2) Code:
bind pub $next(flag) $temp(1) next:$temp(2) Code:
proc next:voice {nick uhost handle chan arg} {
Code:
proc next:v {nick uhost handle chan arg} {
Code:
proc next:helped {nick uhost handle chan arg} {
Code:
proc next:h {nick uhost handle chan arg} {
Code:
proc next:noidle {nick uhost handle chan arg} {
Code:
proc next:b {nick uhost handle chan arg} {
Code:
proc next:skip {nick uhost handle chan arg} {
Code:
proc next:s {nick uhost handle chan arg} {
Code:
proc next:put {nick uhost handle chan arg} {
Code:
proc next:p {nick uhost handle chan arg} {
Code:
proc next:list {nick uhost handle chan arg} {
Code:
proc next:l {nick uhost handle chan arg} {
Pentru notice pe consola adaugi linia: Code:
putserv "NOTICE #consola :mesajul tau" dupa linia 185 adica: Code:
putserv "NOTICE $nick :$temp(post)"
__________________
Quote:
|
|
|
|
|
|
|
#3 (permalink) |
|
Junior Member
|
Am facut tot ceea ce ai scris tu, dar uite ce s-a intamplat
Code:
(Quit: Warning! eggdrop.conf file is missing or has errors. BOT shutdowned. Error: can't read "temp(list)n v h {} b {} s {} p {} l {}": no such variable)
__________________
Practice Makes Perfect. |
|
|
|
|
|
#4 (permalink) |
|
Junior Member
|
Cum este setata limita la forum pentru mai mult de 2000 si ceva de linii sau de ce draq o fi, iti dau link-ul de unde sa-l iei
![]() DOWNLOAD si iei next.tcl ti l-am urcat acolo. Tot ce tre sa faci u, este sa schimbi #chan cu canalul tau pe care vrei sa-ti dea notice. Have phun.
__________________
Ombladon Rulez !! Last edited by KShadow; 28-05-2007 at 22:26. Reason: PS: Nu trebui sa modificati procesele mai sus, pentru ca NU AU NICI O LEGATURA ;-) |
|
|
|