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 with ctcp version (version works, outcome doesn't)

Help for those learning Tcl or writing their own scripts.
Post Reply
b
barcode
Voice
Posts: 6
Joined: Sun Jan 17, 2010 7:56 pm

Help with ctcp version (version works, outcome doesn't)

Post by barcode »

Hey, I managed to get my bot to version anyone connecting from a specific isp, which is good because that's what I wanted. However, I also want it to ban depending on what the version reply is.

Yes I know that's a silly way, but this isn't a typical ban on version deal. Basically we only have two people who connect from the same isp and same state, one of them uses mibbit so it is easy to pick them apart.

Code: Select all

bind ctcr - VERSION version:reply
bind join - * check:version

proc check:version {nick host hand chan} {
 global cversion
 set cversion([string tolower $nick]) 1
 if {[string match -nocase "*@*.state.isp.net" $host]} {
  putserv "privmsg $nick :\001VERSION\001"
 }
}

proc version:reply {nick host hand chan dest kw arg} {
 global cversion
 if {[isbotnick $dest] && [info exists cversion([string tolower $nick])] && [onchan $nick $chan]} {
   if {[string match -nocase "*their version reply*" $arg]} {
   putserv "KICK $chan $nick :lol"
   unset cversion([string tolower $nick])
  }
 }
}
Okay it only says kick there as I was only using kick for testing, but for some reason it doesn't kick o.0 I have tried a few edits to the version:reply proc but i can't get it to do it. I am by no means a pro, in fact I'm still fairly new to tcl, although I am decent at editing and making a few small scripts for my eggdrop. I am sure you can tell all that, I've most probably made a stupid mistake or I have overlooked something.

All I need it to do is kick the user if the version reply matches the version reply of the user I want kicked. I'll add the ban syntax in myself, and like I said I got it to only version someone from a specific isp in a specific state, it's just the outcome if version matches the bad one.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

There seems to be one argument too many in your version:reply proc... drop the chan argument.
NML_375
b
barcode
Voice
Posts: 6
Joined: Sun Jan 17, 2010 7:56 pm

Post by barcode »

Hmm, still doesn't work.

Thanks for the reply, though.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Next step then would be to add various putlogs for debugging, as to see what is actually going on in your script...
NML_375
b
barcode
Voice
Posts: 6
Joined: Sun Jan 17, 2010 7:56 pm

Post by barcode »

Man this has me stumped. I've tried to test if there are any errors yet there aren't, nothing coming up in logs at all. Just looking at the code it should work, but for some reason it isn't kicking on bad version from the user.

It will version them if the isp and state match, but it won't carry out the second proc at all for some reason, yet it should. I removed the extra argument, and I tried to catch any errors but there aren't any.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Could you issue the command .binds ctcr all on your dcc chat partyline, and post the output here?
NML_375
b
barcode
Voice
Posts: 6
Joined: Sun Jan 17, 2010 7:56 pm

Post by barcode »

Sure.
<(eggdrop> TYPE FLGS COMMAND HITS BINDING (TCL)
<(eggdrop> ctcr -|- VERSION 0 version:reply
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

'k, that means the binding has yet not been triggered. Which version of eggdrop are you using, if I may ask?
NML_375
b
barcode
Voice
Posts: 6
Joined: Sun Jan 17, 2010 7:56 pm

Post by barcode »

The bots version is v1.6.18.

For some reason it isn't the latest, I've a few bots and must have forgot. I'll update it now and see if *.19 fixes anything and I'll edit this post.

edit: Upgraded, but not a problem with version I see. Unless, I'm using outdated code or something which I don't think I am, but I could be wrong.
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

This is the proc i use to catch ctcp reply's

Code: Select all

proc ctcr:something {nick uhost hand dest keyword text} {
 if {$keyword == "VERSION"} {
  ...do something
 }
}

 bind ctcr -|- "*" proc ctcr:something
b
barcode
Voice
Posts: 6
Joined: Sun Jan 17, 2010 7:56 pm

Post by barcode »

Thanks dude. Looks like it was a problem with the way I made the bind. Works fine, now.

Thanks again.
Post Reply