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.

Ignore [function] has being a function

Old posts that have not been replied to for several years.
Locked
o
oldfield

Post by oldfield »

I started to script my tcls for a time but yet i have a problem that i couldn't resolve for myself. In my !kickban command, if a target nick is in the form of [justanick], the script thinks that 'justanick' is a function and of course gives an error because no such function exists. Can I pass literal arguments to a putkick command (or every other command) bypassing the [] and make the kick ? I read somewhere that backslash[backslash cound be the solution, but how can I make the tcl interpreter assume that [nick] is a nick and not a function ?! Thanks in advance

_________________
Best regards, Marco Ferra

<font size=-1>[ This Message was edited by: oldfield on 2001-09-28 19:36 ]</font>

<font size=-1>[ This Message was edited by: oldfield on 2001-09-28 19:36 ]</font>
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

Its all to do with how you handle strings in the script. Paste the code and we'll tell you what you've done wrong.
o
oldfield

Post by oldfield »

# syntax: !kb <nick> [reason]

bind pub o|o !kb pub:kickban

proc cbot {nick chan tnick} {
if {[botisop $chan]} {
if {[onchan $tnick $chan]} {
return 1
} else { puthelp "NOTICE $nick :no such nick on channel!" ; return 0 }
} else { puthelp "NOTICE $nick :i dont have ops!" ; return 0 }
}

proc pub:kickban {nick uhost hand chan text} {
set tnick [lindex $text 0]
if {[cbot $nick $chan $tnick]} {
if {[lindex $text 1] != ""} { set reason [lrange $text 1 end] } else { set reason banned }
newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 10
utimer 5 "putkick [$chan $tnick $reason]"
}
}

---

I'm almost sure that my problem is in utimer 5 "putkick [$chan $tnick $reason]"
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

your problem is that you're using list functions on strings. try this

Code: Select all


 # syntax: !kb <nick> [reason] 

bind pub o|o !kb pub:kickban 

proc cbot {nick chan tnick} { 
if {[botisop $chan]} { 
if {[onchan $tnick $chan]} { 
return 1 
} else { puthelp "NOTICE $nick :no such nick on channel!" ; return 0 } 
} else { puthelp "NOTICE $nick :i dont have ops!" ; return 0 } 
} 

proc pub:kickban {nick uhost hand chan text} { 
set tnick [lindex [split $text] 0] 
if {[cbot $nick $chan $tnick]} { 
if {[lindex [split $text] 1] != ""} { set reason [join [lrange [split $text] 1 end]] } else { set reason banned } 
newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 10 
utimer 5 [list putkick $chan $tnick $reason] 
} 
} 

note that this is untested code
o
oldfield

Post by oldfield »

The code works... your code works. Thank you. Now I will pass my eyes on the tcl manual to understand the changes. :smile:
Locked