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 for those learning Tcl or writing their own scripts.
GeeX
Voice
Posts: 29 Joined: Mon Sep 19, 2005 4:29 am
Post
by GeeX » Thu Feb 23, 2006 12:48 pm
Hi,
I've got a problem. I want to compare two varaibles.
Code: Select all
# The first variable
set idents "ident ident ident..."
# The second variable
set presentidents ""
#Here the Script search for the idents in chan and after that the script writes the present idents in the second variable and compare it with the first one.
And here is my problem, i don't know how to get idents that are not in the presentidents. Hope you get my problem.
Please help.
Greetz,
GeeX aka LaW
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Fri Feb 24, 2006 12:19 am
connection, sharing, dcc problems? click
<here>
before asking for scripting help, read
<this>
use
GeeX
Voice
Posts: 29 Joined: Mon Sep 19, 2005 4:29 am
Post
by GeeX » Fri Feb 24, 2006 12:59 pm
Thx to Tosser, problem is solved.
Code: Select all
# __ __ __
# /\ \ /\ \ __/\ \
# \ \ \ __ \ \ \/\ \ \ \
# \ \ \ __ /'__`\ \ \ \ \ \ \ \
# \ \ \_\ \/\ \_\ \_\ \ \_/ \_\ \
# \ \____/\ \__/ \_\\ `\___ ___/
# \/___/ \/__/\/_/ '\/__//__/
#
# sBNC user Script by LaW.
#
# Don't change anything.
# Report bugs to #GeeX on Quakenet.
# Counts/checks/search for sbnc user
# configuration
# variables
set sbnc(trigger) "\!"
set sbnc(version) "1.4"
set sbnc(author) "LaW (#GeeX on Quakenet)"
set sbnc(vhost) "*vhost of your server*"
set sbnc(ip) "*ip of your server*"
set sbnc(db) "ident1 ident2 ident3"
# bindings
bind pub n $sbnc(trigger)sbnc pub:sbnc
# copyright
putlog "sBNC user Script version $sbnc(version) scripted by $sbnc(author)"
# source (again DO NOT change anything if you are not 100% sure)
proc pub:sbnc { nick uhost hand chan text } {
global sbnc
set cmd [lindex $text 0]
if {$cmd == "list"} {
set sbnc(user) 0
foreach nick [chanlist $chan] {
set userhost [getchanhost $nick]
foreach ident [split $sbnc(db)] {
if {[string match "*$ident*" [lindex [split $userhost @] 0]]} {
incr sbnc(user)
}
}
}
putquick "PRIVMSG $chan :\0031,0\x5B\0032\002\xBB\002\0031 sBNC user in $chan \0032\002\xAB\002\0031\x5D\x5B\0032\002\xBB\002\0031 $sbnc(user) \0032\002\xAB\002\0031\x5D\003"
}
if {$cmd == "check"} {
set sbnc(nomodex) ""
foreach nick [chanlist $chan] {
set userhost [getchanhost $nick]
if {[string match $sbnc(vhost) [lindex [split $userhost @] 1]] || [string match $sbnc(ip) [lindex [split $userhost @] 1]] } {
lappend sbnc(nomodex) $nick
}
}
if {$sbnc(nomodex) == ""} {
putquick "PRIVMSG $chan :\0031,0\x5B\0032\002\xBB\002\0031 There are no users without mode +x \0032\002\xAB\002\0031\x5D\003"
} else {
putquick "PRIVMSG $chan :\0031,0\x5B\0032\002\xBB\002\0031 User without Mode +x \0032\002\xAB\002\0031\x5D\x5B\0032\002\xBB\002\0031 $sbnc(nomodex) \0032\002\xAB\002\0031\x5D\x5B\0032\002\xBB\002\0031 Please type !modex to see how to set mode +x \0032\002\xAB\002\0031\x5D\003"
}
}
if {$cmd == "available"} {
set sbnc(missing) ""
foreach nick [chanlist $chan] {
set idents [lindex [split [getchanhost $nick $chan] @] 0]
foreach ident [split $sbnc(db)] {
if {[string match "*$ident*" "$idents"]} {
lappend sbnc(missing) $idents
}
}
}
set sbnc(mlist) ""
foreach idents [split $sbnc(db)] {
if {![string match "*$idents*" "$sbnc(missing)"]} {
lappend sbnc(mlist) $idents
}
}
if {$sbnc(mlist) == ""} {
putquick "PRIVMSG $chan :\0031,0\x5B\0032\002\xBB\002\0031 All users are available in $chan \0032\002\xAB\002\0031\x5D\003"
} else {
putquick "PRIVMSG $chan :\0031,0\x5B\0032\002\xBB\002\0031 Not available users \0032\002\xAB\002\0031\x5D\x5B\0032\002\xBB\002\0031 $sbnc(mlist) \0032\002\xAB\002\0031\x5D\003"
}
}
}