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.

Help to fix errors in script :) [SOLVED]

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Help to fix errors in script :) [SOLVED]

Post by TCL_no_TK »

I've wrote down a script a few weeks back, was pretty rough but thought it was simple enough to work :roll: found out that its not been working. And after taking the time to go over, haven't been able to fix the following errors:
Tcl error [part:botcover]: missing close-bracket
-- When someone parts the channel.
[08:41:17] <Me> .set errorInfo
[08:41:17] <Bot> [08:44] #Me# set errorInfo
[08:41:18] <Bot> Currently: missing close-bracket
[08:41:18] <Bot> Currently: ("if" test expression)
[08:41:18] <Bot> Currently: while compiling
[08:41:18] <Bot> Currently: "if {($nick != $botnick) && ($nick == [lindex $botcover_cover 0]) || ($nick == [lindex $botcover_cover 1]) && (![botisop $channel) && ([matchattr $botn..."
[08:41:18] <Bot> Currently: (compiling body of proc "part:botcover", line 3)
[08:41:18] <Bot> Currently: invoked from within
[08:41:18] <Bot> Currently: "part:botcover $_p1 $_p2 $_p3 $_p4 $_p5"
-- output of .set errorInfo

The full snipplet is

Code: Select all

set botcover_cover "bot2cover1 bot2cover2"
set botcover_bots "coverbot1 coverbot2"
set botcover_snick "opservice"

proc part:botcover {nick host handle channel {msg ""}} {
global botnick botcover_snick botcover_bots botcover_cover
 if {(![isbotnick $nick]) && ($nick == [lindex $botcover_cover 0]) || ($nick == [lindex $botcover_cover 1]) && (![botisop $channel]) && ([matchattr $botnick |+C $channel])} {
  chattr [lindex $botcover_bots 0] "-|+flov $channel"
   chattr [lindex $botcover_bots 1] "-|+flov $channel"
     putserv "PRIVMSG $botcover_snick :OP $channel $botnick"
      return
 }
}

proc sign:botcover {nick host handle channel reason} {
global botnick botcover_snick botcover_bots botcover_cover
 if {(![isbotnick $nick]) && ($nick == [lindex $botcover_cover 0]) || ($nick == [lindex $botcover_cover 1]) && (![botisop $channel]) && ([matchattr $botnick |+C $channel])} {
  chattr [lindex $botcover_bots 0] "-|+flov $channel"
   chattr [lindex $botcover_bots 1] "-|+flov $channel"
     putserv "PRIVMSG $botcover_snick :OP $channel $botnick"
      return
 }
}

proc splt:botcover {nick host handle channel} {
global botnick botcover_snick botcover_bots botcover_cover
 if {(![isbotnick $nick]) && ($nick == [lindex $botcover_cover 0]) || ($nick == [lindex $botcover_cover 1]) && (![botisop $channel]) && ([matchattr $botnick |+C $channel])} {
  chattr [lindex $botcover_bots 0] "-|+flov $channel"
   chattr [lindex $botcover_bots 1] "-|+flov $channel"
     putserv "PRIVMSG $botcover_snick :OP $channel $botnick"
      return
 }
}

bind splt - "* *" splt:botcover
bind sign - "* *" sign:botcover
bind part - "* *" part:botcover

putlog "loaded botcover.tcl version 1.0.3b"
return
sorry for bother :oops:

EDIT: fixed a few errors noted by Users below. :) Thx :D
Last edited by TCL_no_TK on Sun Mar 02, 2008 1:40 am, edited 2 times in total.
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

Look at

Code: Select all

&& (![botisop $channel) &&
You forget ].
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

Post by honeybee »

instead of using

Code: Select all

$nick != $botnick
and so on...
why don't you use

Code: Select all

[string equal -nocase $nick $::botnick]
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Maybe because "equal" isn't a valid 'string' argument across all Tcl versions. Just a thought.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Actually, for the special case of testing some nick against bots own nick, use the isbotnick function.

Using "string equal" does have the advantage of offering non-case sensitive matching over simple "string" != "string". True, string equal is not available in older versions of tcl, but then again, I find these older versions (8.0 or older) more and more rare. If this is a concern, add some notice 'bout script requiring tcl 8.2 or newer.
NML_375
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

Post by honeybee »

yeah you hardly find tcl version lower than tcl8.4 on most public shells may be if someone is using their personal box they should update the tcl version for good.

And.. I suggested him string equal function because he has been using "string" == "string" all over his script.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

For those that don't need the bloat of newer eggdrop versions, older eggdrop versions require older Tcl versions (without source code modification). I myself have two separate botnets, one based on 1.1.5, and another based on 1.6.x. But I digress... I didn't want to hijack this thread with this debate, just found it irrelevant a method one chooses to implement something if the result is the same. What is it they say? There's more than one way to skin a cat...
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Thanks :) gonna upload it soon and see if it fixes the problems. And maybe look in to getting new glasses :shock:

Update: Works great! nice one :D
Post Reply