| View previous topic :: View next topic |
| Author |
Message |
GeeX Voice
Joined: 19 Sep 2005 Posts: 29
|
Posted: Thu Feb 23, 2006 12:48 pm Post subject: Compare two variables |
|
|
Hi,
I've got a problem. I want to compare two varaibles.
| Code: |
# 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 |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Feb 24, 2006 12:19 am Post subject: |
|
|
you need lsearch _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
GeeX Voice
Joined: 19 Sep 2005 Posts: 29
|
Posted: Fri Feb 24, 2006 12:59 pm Post subject: |
|
|
Thx to Tosser, problem is solved.
| Code: |
# __ __ __
# /\ \ /\ \ __/\ \
# \ \ \ __ \ \ \/\ \ \ \
# \ \ \ __ /'__`\ \ \ \ \ \ \ \
# \ \ \_\ \/\ \_\ \_\ \ \_/ \_\ \
# \ \____/\ \__/ \_\\ `\___ ___/
# \/___/ \/__/\/_/ '\/__//__/
#
# 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"
}
}
}
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|