Страница 1 из 1

random msg to unregistered user

СообщениеДобавлено: 09 июн 2012 19:15
heartbroken
hi

i am trying to write a code for when someone connecting to the server 60 seconds later my bot gonna check that nickname if this nickname is an unregistered or not if its unregistered my bot gonna send him/her to a random msg from a txt file . . i've been try to make something like this but the code wont work like that (my bot has oper flag btw.) and couldnt sent msgs to the user.it should be two procs into this code ..i guess ..but the problem is these two procs wont work together correctly like i want .
Код: Выделить всё
bind raw * notice go:entry

proc go:entry {from keyword arg} {
  set nick [lindex $arg 9]
  if {[string match "*Client connecting*" $arg]} {
   utimer 55 putquick "privmsg nickserv info $nick"
  }
  if {[string match "*is not registered*" $arg]} {
    w "entry.txt" $nick 
  }
}

proc w {txt nick} { 
  set readfile [open scripts/$txt r]
  set listenter [split [subst -nocommands [read $readfile]] "\n"]
  set rmsg [lindex $listenter [rand [llength $listenter]]]
  utimer 60 [list putquick "privmsg $nick :$rmsg"]
  close $readfile


thanks
my best regards .

Re: random msg to unregistered user

СообщениеДобавлено: 13 июн 2012 07:40
tvrsh
Show you errors from partyline. I cant check this script because I have no bots with oper flags.
Maybe you have mistakes in go:entry proc. Are you shure what nick always on tenth place like here:
set nick [lindex $arg 9]
?
And in $arg you get a string. But lindex uses for lists. So, you need to do
set arg [split $arg]
before the lindex command. And after that in if you do string match, but this command is for strings, it must looks like this:
if {[string match "*Client connecting*" [join $arg]]} {

Dont forget to check this everywhere.

Re: random msg to unregistered user

СообщениеДобавлено: 13 июн 2012 16:32
heartbroken
Thank you tvrsh and thnx for the tips i'll keep these ...problem just been solved with a mirc scripting snippet. some of my friend gave me a lil snippet for mirc socket bot for to do this kinda job.

with this tcl problem was i dont get any error msgs but bot couldnt see who has unregistered nick i dunno realy but i thought probably problem cus by services .this is ruLLz services and it hasnt detail about nickname* into /ns info commands reply.and i guess this tcl code couldnt get that"nickname" and therefor wont send msg to the nick cus it couldnt find it.

anyway problem been solved for me now.socket bot doing this job.so ..

thank you very much :)