egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compare two variables

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
GeeX
Voice


Joined: 19 Sep 2005
Posts: 29

PostPosted: Thu Feb 23, 2006 12:48 pm    Post subject: Compare two variables Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Feb 24, 2006 12:19 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
GeeX
Voice


Joined: 19 Sep 2005
Posts: 29

PostPosted: Fri Feb 24, 2006 12:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber