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 

Need help with variables

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


Joined: 19 Jan 2010
Posts: 1

PostPosted: Tue Jan 19, 2010 3:18 pm    Post subject: Need help with variables Reply with quote

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
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Tue Jan 19, 2010 7:30 pm    Post subject: Reply with quote

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
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