random msg to unregistered user

Решение вопросов при работе с TCL скриптами.

Модератор: Модераторы

random msg to unregistered user

Сообщение heartbroken » 09 июн 2012 19:15

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 .
Life iS Just a dReaM oN tHE wAy to DeaTh
Аватара пользователя
heartbroken
 
Сообщения: 18
Зарегистрирован: 07 апр 2012 09:25
Благодарил (а): 9 раз.
Поблагодарили: 0 раз.

Re: random msg to unregistered user

Сообщение tvrsh » 13 июн 2012 07:40

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.
Have fun.
-
Получить помощь можно на каналах #egghelp в сети IrcNet.ru и #eggdrop в сети RusNet(Ключ канала eggdrop).
Перед созданием новой темы внимательно читайте Правила оформления топиков.
Аватара пользователя
tvrsh
 
Сообщения: 1230
Зарегистрирован: 19 авг 2008 16:55
Откуда: Russian Federation, Podolsk
Благодарил (а): 6 раз.
Поблагодарили: 130 раз.
Версия бота: Eggdrop 1.6.20+suzi

Re: random msg to unregistered user

Сообщение heartbroken » 13 июн 2012 16:32

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 :)
Life iS Just a dReaM oN tHE wAy to DeaTh
Аватара пользователя
heartbroken
 
Сообщения: 18
Зарегистрирован: 07 апр 2012 09:25
Благодарил (а): 9 раз.
Поблагодарили: 0 раз.


Вернуться в TCL скрипты

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 6

cron