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.

Variable issue

Old posts that have not been replied to for several years.
r
ratman
Voice
Posts: 25
Joined: Thu Jun 26, 2003 8:35 pm
Location: CT
Contact:

Variable issue

Post by ratman »

Getting this iin a script I modified

Tcl error in file 'greetbot.conf':
[19:57] can't read "chan": no such variable
while executing
"string match -nocase "$greetchan" $chan"
(file "scripts/greeting.tcl" line 1)
(file "greetbot.conf" line 1)


What now. I can't SEE any code errors?
Securityarsenal IRC Administrator

irc.homecomputersecurity.net:6667-7000
Website
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

It clearly say's the error :P

E.g. you have {nick uhost handle channel arg}, if you have like this, then change it to {nick uhost handle chan arg} ..Just put chan in it, or change variable....
r
ratman
Voice
Posts: 25
Joined: Thu Jun 26, 2003 8:35 pm
Location: CT
Contact:

Post by ratman »

]Kami[ wrote:It clearly say's the error :P

E.g. you have {nick uhost handle channel arg}, if you have like this, then change it to {nick uhost handle chan arg} ..Just put chan in it, or change variable....
I have {nick uhost handle chan arg} but it is still doing it :(
Securityarsenal IRC Administrator

irc.homecomputersecurity.net:6667-7000
Website
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Paste the script (procedure) here, so we can take a closer look. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
r
ratman
Voice
Posts: 25
Joined: Thu Jun 26, 2003 8:35 pm
Location: CT
Contact:

Post by ratman »

awyeah wrote:Paste the script (procedure) here, so we can take a closer look. :mrgreen:
Here we go:

proc proc:greet {nick mask hand chan} {
global greetchan
global greetvar
global greeting
global greetchan2
global greeting2
global greetchan3
global greeting3
global greetchan4
global greeting4
global greetchan5
global greeting5
global greetchan6
global greeting6
global greetchan7
global greeting7
global greetchan8
global greeting8
global greetchan9
global greeting9
global greetchan10
global greeting10
global greetchan11
global greeting11
global greetchan12
global greeting12
global greetchan13
global greeting13
global greetchan14
global greeting14
global greetchan15
global greeting15
global greetchan16
global greeting16
global greetchan17
global greeting17
global greetchan18
global greeting18
global greetchan19
global greeting19
global greetchan20
global greeting20
global chan
}

if {[string match -nocase "$greetchan" $chan]} {

if {[string match -nocase "0" $greetvar]} {
regsub -all "\t" [split [exec [lindex "cat greeting.txt" 0] [join [lrange "cat greeting.txt" 1 end]]] \n] " " results
foreach line $results { puthelp "Notice $nick :$line" }
}
if {[string match -nocase "1" $greetvar]} {
putquick "Notice $nick :$greeting"
}
}

rest of script similar
Securityarsenal IRC Administrator

irc.homecomputersecurity.net:6667-7000
Website
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Ow, my gawd.
You have closed the procedure, just by declaring variables.
So the rest code after it, will bind on rehash, restart etc.
Plus try to declare all of them in 1 line. Makes it easier to read as well.

First leme re-arrange it and put it in a readable manner.
By the way alot of logic in your script is wrong.

[1] Use lists for matching the channel (with lsearch -exact)
[2] Don't use string match for matching channel variables.
[3] Declaring alot of global variables make it messey, you can use arrays... I mean variables with ( and ).

Code: Select all

There we go: 

proc proc:greet {nick mask hand chan} { 
 global greetchan greetvar greeting greetchan2 greeting2 greetchan3
 global greeting3 greetchan4 greeting4 greetchan5 greeting5 greetchan6
 global greeting6 greetchan7 greeting7 greetchan8 greeting8 greetchan9
 global greeting9 greetchan10 greeting10 greetchan11 greeting11 greetchan12
 global greeting12 greetchan13 greeting13 greetchan14 greeting14 greetchan15 
 global greeting15 greetchan16 greeting16 greetchan17 greeting17 greetchan18
 global greeting18 greetchan19 greeting19 greetchan20 greeting20
  if {[string match -nocase *$greetchan* $chan]} {
  if {[string match -nocase "0" $greetvar]} {
  regsub -all "\t" [split [exec [lindex "cat greeting.txt" 0] [join [lrange "cat greeting.txt" 1 end]]] \n] " " results 
   foreach line $results {
    puthelp "Notice $nick :$line"
    }
  }
  if {[string match -nocase "1" $greetvar]} {
  putquick "Notice $nick :$greeting" 
  }
 }
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
r
ratman
Voice
Posts: 25
Joined: Thu Jun 26, 2003 8:35 pm
Location: CT
Contact:

Post by ratman »

Here is the whole big mess:

Code: Select all

#################################################
## greeting.tcl by kazoo                       ##  
## www.conflabit.net                           ## 
## david@conflabit.net                         ##
##                                             ##
## Modifications by Ratman                     ##               
## http://www.homecomputersecurity.net:81      ##
## ratman6@charter.net                         ## 
#################################################
# For the channel greeting..
# You will need to set greeting.txt
# To your greeting in your eggdrop directory
# Only if your greetvar is set to 0
##############################
########## Variables #########
##############################
# Once these are set and have loaded once, You will have to
# Comment all of these out to make the set command work
#
#
# If you want greeting to read from greeting.txt set this to 0
# If you want it to read from the variable, set this to 1
set greetvar 1
# Set this to your Channel Greeting
set greeting "Welcome to #lobby.  If you can see the message you are in the channel"
# Set this to your greeting channel
# * for all
set greetchan "#lobby"
# Repeat for the following 19.
# Leave blank if you don't need them
set greeting2 "Welcome to #teamchevelle.  If you can see the message you are in the channel"
set greetchan2 "#teamchevelle"
set greeting3 "Welcome to #teamcamaro.  If you can see the message you are in the channel"
set greetchan3 "#teamcamaro"
set greeting4 "Welcome to #apparition.  If you can see the message you are in the channel"
set greetchan4 "#apparition"
set greeting5 "Welcome to #angellesavoie.  If you can see the message you are in the channel"
set greetchan5 "#angellesavoie"
set greeting6 "Welcome to our channel!"
set greetchan6 "#yourchannel"
set greeting7 "Welcome to our channel!"
set greetchan7 "#yourchannel"
set greeting8 "Welcome to our channel!"
set greetchan8 "#yourchannel"
set greeting9 "Welcome to our channel!"
set greetchan9 "#yourchannel"
set greeting10 "Welcome to our channel!"
set greetchan10 "#yourchannel"
# Have fun!
############
## SCRIPT ##
############
bind join - * proc:greet
proc proc:greet {nick mask hand chan} { 
global greetchan greetvar greeting greetchan2 greeting2 greetchan3 
global greeting3 greetchan4 greeting4 greetchan5 greeting5 greetchan6 
global greeting6 greetchan7 greeting7 greetchan8 greeting8 greetchan9 
global greeting9 greetchan10 greeting10 greetchan11 greeting11 greetchan12 
global greeting12 greetchan13 greeting13 greetchan14 greeting14 greetchan15 
global greeting15 greetchan16 greeting16 greetchan17 greeting17 greetchan18 
global greeting18 greetchan19 greeting19 greetchan20 greeting20 


  if {[string match -nocase "$greetchan" $chan]} {

     if {[string match -nocase "0" $greetvar]} {
	regsub -all "\t" [split [exec [lindex "cat greeting.txt" 0] [join [lrange "cat greeting.txt" 1 end]]] \n] " " results
	foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting"
}
}
   if {[string match -nocase "$greetchan2" $chan]} {

     if {[string match -nocase "0" $greetvar]} {  	
        regsub -all "\t" [split [exec [lindex "cat greeting2.txt" 0] [join [lrange "cat greeting2.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting2"
}
}
   if {[string match -nocase "$greetchan3" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting3.txt" 0] [join [lrange "cat greeting3.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting3"
}
}
   if {[string match -nocase "$greetchan4" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting4.txt" 0] [join [lrange "cat greeting4.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting4"
}
}
   if {[string match -nocase "$greetchan5" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting5.txt" 0] [join [lrange "cat greeting5.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting5"
}
}
   if {[string match -nocase "$greetchan6" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting6.txt" 0] [join [lrange "cat greeting6.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting6"
}
}
   if {[string match -nocase "$greetchan7" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting7.txt" 0] [join [lrange "cat greeting7.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting7"
}
}
   if {[string match -nocase "$greetchan8" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting8.txt" 0] [join [lrange "cat greeting8.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting8"
}
}
   if {[string match -nocase "$greetchan9" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting9.txt" 0] [join [lrange "cat greeting9.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting9"
}
}
   if {[string match -nocase "$greetchan10" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting10.txt" 0] [join [lrange "cat greeting10.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting10"

     if {[string match -nocase "$greetchan11" $chan]} {

     if {[string match -nocase "0" $greetvar]} {  	
        regsub -all "\t" [split [exec [lindex "cat greeting11.txt" 0] [join [lrange "cat greeting2.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting11"
}
}
   if {[string match -nocase "$greetchan12" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting12.txt" 0] [join [lrange "cat greeting3.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting12"
}
}
   if {[string match -nocase "$greetchan13" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting13.txt" 0] [join [lrange "cat greeting4.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting13"
}
}
   if {[string match -nocase "$greetchan14" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting14.txt" 0] [join [lrange "cat greeting5.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting14"
}
}
   if {[string match -nocase "$greetchan15" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting15.txt" 0] [join [lrange "cat greeting6.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting15"
}
}
   if {[string match -nocase "$greetchan16" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting16.txt" 0] [join [lrange "cat greeting7.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting16"
}
}
   if {[string match -nocase "$greetchan17" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting17.txt" 0] [join [lrange "cat greeting8.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting17"
}
}
   if {[string match -nocase "$greetchan18" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting18.txt" 0] [join [lrange "cat greeting9.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting18"
}
}
   if {[string match -nocase "$greetchan19" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting19.txt" 0] [join [lrange "cat greeting10.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting19"
}

    if {[string match -nocase "$greetchan20" $chan]} { 

     if {[string match -nocase "0" $greetvar]} {
        regsub -all "\t" [split [exec [lindex "cat greeting20.txt" 0] [join [lrange "cat greeting10.txt" 1 end]]] \n] " " results
        foreach line $results { puthelp "Notice $nick :$line" }
}
     if {[string match -nocase "1" $greetvar]} {
        putquick "Notice $nick :$greeting20"

}
}
}
bind pub n|f set cmd:setgreet
proc cmd:setgreet {nick host hand chan text} { 
global greetchan greetvar greeting greetchan2 greeting2 greetchan3 
global greeting3 greetchan4 greeting4 greetchan5 greeting5 greetchan6 
global greeting6 greetchan7 greeting7 greetchan8 greeting8 greetchan9 
global greeting9 greetchan10 greeting10 greetchan11 greeting11 greetchan12 
global greeting12 greetchan13 greeting13 greetchan14 greeting14 greetchan15 
global greeting15 greetchan16 greeting16 greetchan17 greeting17 greetchan18 
global greeting18 greetchan19 greeting19 greetchan20 greeting20 

 if {[string match -nocase "greeting" $text"]} { 

   if {[string match -nocase "$greetchan" $chan]} { 
	set $greeting "$text"
	putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan2" $chan]} {
        set $greeting2 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan3" $chan]} {
        set $greeting3 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan4" $chan]} {
        set $greeting4 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan5" $chan]} {
        set $greeting5 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan6" $chan]} {
        set $greeting6 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan7" $chan]} {
        set $greeting7 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan8" $chan]} {
        set $greeting8 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan9" $chan]} {
        set $greeting9 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan10" $chan]} {
        set $greeting10 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"

 if {[string match -nocase "$greetchan11" $chan]} { 
	set $greeting11 "$text"
	putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan12" $chan]} {
        set $greeting12 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan13" $chan]} {
        set $greeting13 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan14" $chan]} {
        set $greeting14 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan15" $chan]} {
        set $greeting15 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan16" $chan]} {
        set $greeting16 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan17" $chan]} {
        set $greeting17 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan18" $chan]} {
        set $greeting18 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan19" $chan]} {
        set $greeting19 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
   if {[string match -nocase "$greetchan20" $chan]} {
        set $greeting20 "$text"
        putserv "Notice $nick :Greeting for $chan set to $text"
}
}
}

putlog "greeting.tcl by kazoo (david@conflabit.net)With Mods by Ratman - LOADED!!"

# kazoo (david@conflabit.net)
This script needs alot more help than a TCL Newbie can give....wanna help me out? :)
Securityarsenal IRC Administrator

irc.homecomputersecurity.net:6667-7000
Website
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Seriously... if I have time, I can rewrite this whole script in less than 10-15 lines, out of the total 200+ lines. :wink:

And still it will prove to be the same efficient, as it currently is! :mrgreen:
There are very good, customizable greet scripts out there! Why did you specifically choose this one? :roll:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
r
ratman
Voice
Posts: 25
Joined: Thu Jun 26, 2003 8:35 pm
Location: CT
Contact:

Post by ratman »

awyeah wrote:Seriously... if I have time, I can rewrite this whole script in less than 10-15 lines, out of the total 200+ lines. :wink:

And still it will prove to be the same efficient, as it currently is! :mrgreen:
There are very good, customizable greet scripts out there! Why did you specifically choose this one? :roll:
I could not find any other script that would handle MULTIPLE channels and worked. Would there be an eaier way to get this script to support mutiple chans BTW/ I'd like it to maybe supprt 100 eventually (nice round number) :)
Securityarsenal IRC Administrator

irc.homecomputersecurity.net:6667-7000
Website
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You can support 1000 channels! (As many as you like!)
You would need one line only.

You can do this in *3 steps* and you will need to edit your previous code, and remove most of the conditions and etc.

Code: Select all

#Define the channels for this script to work on
set greetchans "#chan1 #chan2 #chan3 #mychan #yourchan" 

#Declare the global variable in the procedure
proc:greet {nick mask hand chan} {
 global greetchans greetvar greeting
 .....................
 .....................
}

#This line will be used in your procedure after declaring the variables.
 if {([lsearch -exact [split [string tolower $greetchans]] [string tolower $chan]] == -1)} {
 if {[string match -nocase "0" $greetvar]} { 
 ...................
 ...................
}
Good luck, and try to implement this! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

that will only work if he has the same greeting for all the channels, if he has different greeting it will be better using arrays :)
Last edited by Papillon on Mon Jul 26, 2004 8:05 am, edited 1 time in total.
Elen sila lúmenn' omentielvo
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

True indeed... Papillon, but I think he got how to do it, from here onwards! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
r
ratman
Voice
Posts: 25
Joined: Thu Jun 26, 2003 8:35 pm
Location: CT
Contact:

Post by ratman »

Ok guys, back to my new script. Here is the code I have so far:

Code: Select all

#################################
## greeting.tcl by kazoo   ######
## www.conflabit.net       ######
## david@conflabit.net     ######
#################################
# For the channel greeting..
# You will need to set greeting.txt
# To your greeting in your eggdrop directory
# Only if your greetvar is set to 0
##############################
########## Variables #########
##############################
# Once these are set and have loaded once, You will have to
# Comment all of these out to make the set command work
#
#
# If you want greeting to read from greeting.txt set this to 0
# If you want it to read from the variable, set this to 1
set greetvar 1
# Set this to your Channel Greeting
set greeting "Welcome to #lobby.  If you can see the message you are in the channel"
# Set this to your greeting channel
# * for all
set greetchan "#lobby"
# Repeat for the following 9.
# Leave blank if you don't need them
set greeting2 "Welcome to #teamchevelle.  If you can see the message you are in the channel"
set greetchan2 "#teamchevelle"
set greeting3 "Welcome to #teamcamaro.  If you can see the message you are in the channel"
set greetchan3 "#teamcamaro"
set greeting4 "Welcome to #apparition.  If you can see the message you are in the channel"
set greetchan4 "#apparition"
set greeting5 "Welcome to #angellesavoie.  If you can see the message you are in the channel"
set greetchan5 "#angellesavoie"
set greeting6 "Welcome to our channel!"
set greetchan6 "#yourchannel"
set greeting7 "Welcome to our channel!"
set greetchan7 "#yourchannel"
set greeting8 "Welcome to our channel!"
set greetchan8 "#yourchannel"
set greeting9 "Welcome to our channel!"
set greetchan9 "#yourchannel"
set greeting10 "Welcome to our channel!"
set greetchan10 "#yourchannel"
# Have fun!
############
## SCRIPT ##
############
bind join - * proc:greet

#Declare the global variable in the procedure 
proc:greet {nick mask hand chan} { 
 global greetchans(0) greetvar greeting(0)

 if {([lsearch -exact [split [string tolower $greetchans]] [string tolower $chan]] == -1)} { 
 if {[string match -nocase "0" $greetvar]} { 
Now. I know I have to change all the set lines to reflect the new variable arrays. but when I declare the global variables in the procedure do I have to delclare each array like:

Code: Select all

global greetchans(0) greetchans(1) greetvar greeting(0) greeting(1)
Or can I set up all the variable arrays in one statement like:

Code: Select all

global greetchans(0-100) or global greetchans(0 to 100)
also, do I have to repeat this:

Code: Select all

if {([lsearch -exact [split [string tolower $greetchans]] [string tolower $chan]] == -1)} { 
 if {[string match -nocase "0" $greetvar]} { 
}
}
For each array set or is there some better way?
Securityarsenal IRC Administrator

irc.homecomputersecurity.net:6667-7000
Website
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

This simple script should work without problems:

Code: Select all

bind join - * greet_join

set greet_message "Your message here"

setudef flag greetmsg

proc greet_join {nick uhost hand channel} {
global greet_message
  if {[isbotnick $nick] || ![channel get $channel greetmsg]} {
    return 0
  }
putquick "PRIVMSG $nick :$greet_message"
} 
You can enable it with typing .chanset #yourchannel +greetmsg in partyline or disable it with .chanset #yourchannel -greetmsg ...It also supports unlimited number of channels...
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Here you go.
Use this:

Code: Select all

#If you want greeting to read from greeting.txt set this to 0 
#If you want it to read from the variable, set this to 1 
set greetvar "1"

#Set this to your channel greeting
set greeting "Welcome to the channel.  If you can see this message you are in the channel!"

#Set this to your greeting channels
set greetchans "#funchat #cyberparty #chatterz #beginner #allnitecafe"


bind join - * proc:greet 

proc:greet {nick uhost hand chan} { 
 global greetvar greetchans 
 if {([lsearch -exact [split [string tolower $greetchans]] [string tolower $chan]] == -1)} { 
 if {([string equal $greetvar "0"])} {
  regsub -all "\t" [split [exec [lindex "cat greeting.txt" 0] [join [lrange "cat greeting.txt" 1 end]]] \n] " " results 
  foreach line $results {
   puthelp "Notice $nick :$line"
   } 
  } 
  if {([string equal $greetvar "1"])} { 
   putquick "NOTICE $nick :$greeting" 
  } 
 } 
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked