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.

I need help... cannot figure this out...

Help for those learning Tcl or writing their own scripts.
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Matter of fact, I do:

[04:42:30] Tcl error [kickban]: illegal channel: Testeee

"Testeee" was the nick I was testing it on. So the problem should be in this line:

Code: Select all

putserv "MODE $chan +b [maskhost $whom 0]"
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Actually, it's not in that line. The error you recieve is a tcl error, not an error reported from the irc server. I'd rather look at either onchan or getchanhost - most likely the parameters got mixed up in one of those commands.

Now that I look closer, that's a very prominent difference between the kick_user and kickban procs - the order of the arguments for onchan. Proper syntax is "onchan <target> [channel]", so make sure you've got something along these lines in your code...

Code: Select all

...
} elseif {![onchan $whom $chan]} {
...
NML_375
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Okay, I made a few tweaks and now I get this error:
Tcl error [user_reason]: wrong # args: should be "lrange list first last"

Code: Select all

bind pub o|o !kb user_reason
 proc user_reason {nick host hand chan text} {
  set list [split $text]
  set whom [lindex $list 0]
  set reason [join [lrange $list 1 end]]
    if {$whom == ""} {
       putserv "PRIVMSG $chan :You must specify a nick to kickban."
    } elseif {![onchan $whom $chan]} {
       putserv "PRIVMSG $chan :$whom is not here."
    } else {
       putserv "MODE $chan +b [maskhost [getchanhost $whom $chan] 0]"
    if {$reason == ""} {
       puthelp "KICK $chan $whom :Requested by $nick."
    } else {
       puthelp "KICK $chan $whom :$reason"
    }
  }
}
Did away with the if {$hand !=} { part.. for now at least.
Last edited by Luminous on Sun Feb 21, 2010 10:49 pm, edited 1 time in total.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Hmm...
Posted code looks proper. Please doublecheck the "set reason" line.
NML_375
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

It looks the same as my code.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Hmm... there is no other lrange command within the user_reason proc.. There is one within the maskhost proc posted by User in that other thread.

Do you think you could paste the whole script you've currently got, just to make sure no typos made it in there or such?
NML_375
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

I'm using his original one with my script:

Code: Select all

# Setting:
set maskhostDefaultType 0

# The proc:
proc maskhost [list name [list type $maskhostDefaultType]] {
   if {[scan $name {%[^!]!%[^@]@%s} nick user host]!=3} {
      error "Usage: maskhost <nick!user@host> \[type\]"
   }
   if [string match {[3489]} $type] {
      if [string match {*[0-9]} $host] {
         set host [join [lrange [split $host .] 0 2] .].*
      } elseif {[string match *.*.* $host]} {
         set host *.[join [lrange [split $host .] end-1 end] .]
      }
   }
   if [string match {[1368]} $type] {
      set user *[string trimleft $user ~]
   } elseif {[string match {[2479]} $type]} {
      set user *
   }
   if [string match {[01234]} $type] {
      set nick *
   }
   set name $nick!$user@$host 
Is this really necessary and is it the right one? I reloaded both scripts(separated them into two different files), and I got a new error: Tcl error [user_reason]: Usage: maskhost <nick!user@host> [type]
So.. does that mean... that I need to do: MODE $chan +b [maskhost $whom! 0]?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Well, almost...
If you check closely, you'll see I use a slightly different commandline for the maskhost (in my previous post). It goes something like this:

Code: Select all

...[maskhost "$whom![getchanhost $whom chan]"]...
maskhost expects nick!user@host, while getchanhost only returns the user@host part, the classic one manages without the nick-part (since it's never included in the mask anyway), however, given the setting of masktype, User's version needs the nick-part aswell...
NML_375
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

I ended up figuring it out last night. :D Had to change a few things, but it works now. Thanks for your help, appreciated.
Post Reply