| View previous topic :: View next topic |
| Author |
Message |
_TURBO_ Voice
Joined: 19 Jan 2010 Posts: 1
|
Posted: Tue Jan 19, 2010 3:18 pm Post subject: Need help with variables |
|
|
hi, need some help whit this script.
| Code: |
set badversion {"logoscript" "script"}
bind ctcr - VERSION clientinf
proc clientinf {nick uhost hand dest key arg} {
global badversion
foreach version $badversion {
if {[string match "*[string tolower $version]*" [string tolower $arg]]} {
global script
set script "1"
putserv "privmsg #test :using script var: $script"
}
}
}
bind RAW - 671 whois:ssl
proc whois:ssl {from key text} {
global "ssl"
set ssl "[lindex [split $text " "] 4]"
putserv "privmsg #test :using ssl var $ssl"
}
bind pub - "!sendpass" sp
proc sp {nick uhost hand chan arg} {
global "ssl" "script"
putquick "whois $nick $nick"
putserv "PRIVMSG $nick :\001VERSION\001"
if {$script == "1"} {
puthelp "privmsg #test :dont use script"
if {$ssl != "a"} {
puthelp "privmsg #test :please use ssl" }
} else {
puthelp "privmsg #test :Ok sending pass"
}
} |
Bot says Tcl error [sp]: can't read "script": no such variable |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Jan 19, 2010 7:30 pm Post subject: |
|
|
The part of your code below will only globalise the variable script and set it to 1 when the 'if' statement is passed. When the 'if' statement fails, the variable script does not exist. Rethink the logic.
| Code: |
if {[string match "*[string tolower $version]*" [string tolower $arg]]} {
global script
set script "1"
putserv "privmsg #test :using script var: $script"
}
|
_________________ I must have had nothing to do |
|
| Back to top |
|
 |
|