| View previous topic :: View next topic |
| Author |
Message |
WulfMan72 Voice
Joined: 12 Oct 2005 Posts: 23 Location: Massachusetts
|
Posted: Thu Dec 15, 2005 5:12 pm Post subject: {}'s in nick cause tcl error... |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Dec 15, 2005 5:34 pm Post subject: |
|
|
use arg instead of args because args has a special use in Tcl. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
WulfMan72 Voice
Joined: 12 Oct 2005 Posts: 23 Location: Massachusetts
|
Posted: Thu Dec 15, 2005 6:10 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
WulfMan72 Voice
Joined: 12 Oct 2005 Posts: 23 Location: Massachusetts
|
Posted: Thu Dec 15, 2005 6:22 pm Post subject: |
|
|
| 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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Dec 15, 2005 6:52 pm Post subject: |
|
|
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 |
|
 |
WulfMan72 Voice
Joined: 12 Oct 2005 Posts: 23 Location: Massachusetts
|
Posted: Thu Dec 15, 2005 6:58 pm Post subject: |
|
|
tried that, same error
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Dec 15, 2005 7:04 pm Post subject: |
|
|
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 |
|
 |
WulfMan72 Voice
Joined: 12 Oct 2005 Posts: 23 Location: Massachusetts
|
Posted: Thu Dec 15, 2005 7:13 pm Post subject: |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Thu Dec 15, 2005 7:34 pm Post subject: |
|
|
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 |
|
 |
WulfMan72 Voice
Joined: 12 Oct 2005 Posts: 23 Location: Massachusetts
|
Posted: Thu Dec 15, 2005 7:37 pm Post subject: |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
WulfMan72 Voice
Joined: 12 Oct 2005 Posts: 23 Location: Massachusetts
|
Posted: Thu Dec 15, 2005 7:51 pm Post subject: |
|
|
ahhhhhh perfect, that worked!!!
ty much Fz, I really appreciate the help  |
|
| Back to top |
|
 |
BarkerJr Op

Joined: 30 Mar 2003 Posts: 104
|
Posted: Thu Dec 15, 2005 9:57 pm Post subject: |
|
|
| So, it was all due to forgetting to convert a list to a string before using it as a string? |
|
| Back to top |
|
 |
|