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 

{}'s in nick cause tcl error...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Thu Dec 15, 2005 5:12 pm    Post subject: {}'s in nick cause tcl error... Reply with quote

I'm having an issue with nicks that have {}'s in them

an example of the problem comes from nicks like "{nick}X"

I used:
Code:

set who [lindex [split $args] 0]


but whenever the nick follows the format listed above, I get the error:
Tcl error [kick]: list element in braces followed by "X" instead of space

is there a way to set the nick as a variable and not get this error?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 15, 2005 5:34 pm    Post subject: Reply with quote

use arg instead of args because args has a special use in Tcl.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Thu Dec 15, 2005 6:10 pm    Post subject: Reply with quote

hmmmm tried that Fz, same results, still getting the tcl error.

I'm using a winegg "eggdrop1.6.17"

dunno if that makes a difference, but it also doesn't seem to like the "read" command Confused
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 15, 2005 6:17 pm    Post subject: Reply with quote

Show us the code.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Thu Dec 15, 2005 6:22 pm    Post subject: Reply with quote

Code:

bind pub f kick, kick
proc kick {nick host hand chan arg} {
  set who [lindex [split $arg] 0]
  set reason [lrange $arg 1 end]
    if {![onchan $who $chan]} {
      putchan $chan "$who is not in the channel"
    } else {
   if {[botisop $chan]} {putkick $chan $who $reason}
  }
return 0
}


this code is working for all nicks accept ones with the {}'s in them
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 15, 2005 6:52 pm    Post subject: Reply with quote

Although this shouldn't happen (I tested it with a dcc command), try
Code:
set who [string map {\{ \\\{ \} \\\}} $who]

after setting who [lindex [split $arg] 0].
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Thu Dec 15, 2005 6:58 pm    Post subject: Reply with quote

tried that, same error Sad

here's the revised code just to make sure I did it right:
Code:

bind pub f kick, kick
proc kick {nick host hand chan arg} {
  set who [lindex [split $arg] 0]
  set who [string map {\{ \\\{ \} \\\}} $who]
  set reason [lrange $arg 1 end]
    if {![onchan $who $chan]} {
      putchan $chan "$who is not in the channel"
    } else {
   if {[botisop $chan]} {putkick $chan $who $reason}
  }
return 0
}


and error message again:
[17:55] Tcl error [kick]: list element in braces followed by "B" instead of space
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 15, 2005 7:04 pm    Post subject: Reply with quote

Just noticed
Code:
set reason [lrange $arg 1 end]

should be
Code:
set reason [join [lrange [split $arg] 1 end]]

Also, show us what .set errorInfo returns to know exactly where the error occurs.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Thu Dec 15, 2005 7:13 pm    Post subject: Reply with quote

ok, updated the line for setting the reason variable, and tried to do the .set errorinfo, this is what I got:

#Wulf# set errorinfo
Error: can't read "errorinfo": no such variable
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 15, 2005 7:29 pm    Post subject: Reply with quote

Capital I, errorInfo.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Thu Dec 15, 2005 7:34 pm    Post subject: Reply with quote

From eggdrop.conf:
Quote:
# Comment these two lines if you wish to enable the .tcl and .set commands.
# If you select your owners wisely, you should be okay enabling these.
unbind dcc n tcl *dcc:tcl
unbind dcc n set *dcc:set

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Thu Dec 15, 2005 7:37 pm    Post subject: Reply with quote

ok, I shut the bot down completely and restarted it, went to test it again, and now I'm not getting a tcl error, but I'm getting this in the channel as the bots output:

\{nickname\}X is not in the channel

here's the code as it stands now:
Code:

bind pub f kick, kick
proc kick {nick host hand chan arg} {
  set who [lindex [split $arg] 0]
  set who [string map {\{ \\\{ \} \\\}} $who]
  set reason [join [lrange [split $arg] 1 end]]
    if {![onchan $who $chan]} {
      putchan $chan "$who is not in the channel"
    } else {
   if {[botisop $chan]} {putkick $chan $who $reason}
  }
return 0
}
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 15, 2005 7:45 pm    Post subject: Reply with quote

You can remove the 2nd 'set who...'
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Thu Dec 15, 2005 7:51 pm    Post subject: Reply with quote

ahhhhhh perfect, that worked!!!
ty much Fz, I really appreciate the help Smile
Back to top
View user's profile Send private message
BarkerJr
Op


Joined: 30 Mar 2003
Posts: 104

PostPosted: Thu Dec 15, 2005 9:57 pm    Post subject: Reply with quote

So, it was all due to forgetting to convert a list to a string before using it as a string?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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