Регистрация | Вход
[ Главная · Новые сообщения ]
Форум » Основной раздел » Мастерская » Вопросы по скриптам
Вопросы по скриптам
Vladislav 24.02.12 00:43 #121
В боте нет такого скрипта, там по другому выводит, как я тебе скажу что поправить?

Ищи строку в которой есть \[ например: \[$nick\] и вписывай перед переменной с ником то, что нужно тебе.
Corund 24.02.12 20:09 #122
Извиняюсь, перепутал. Это сторонний скрипт.
Искал вот все равно и не могу найти...
Может быть, подскажете? часть скрипта вот выложу.

Code

#script begin#

set qot(vershort) "1.00 by lmrvsk@RusNet"
set qot(script) "scripts/lcquote-1.00.tcl"
set qot(package) "scripts/lcquote-1.00.zip"

proc check_string {text} {
    regsub -all ">" $text "" text
    regsub -all "<" $text "" text
    regsub -all "|" $text "" text
    regsub -all "&" $text "" text
    return $text
}   

proc qot_flood_init {} {
    global qot qot_flood_array ; if {![string match *:* $qot(flood)]} {putlog "Quotes - var qot(flood) not set correctly." ; return}
    set qot(flood_num) [lindex [split $qot(flood) :] 0] ; set qot(flood_time) [lindex [split $qot(flood) :] 1] ; set i [expr $qot(flood_num) - 1]
    while {$i >= 0} {set qot_flood_array($i) 0 ; incr i -1 ; }
} ; qot_flood_init

proc qot_flood {nick uhost chan} {
    if {[matchattr [nick2hand $nick] o $chan] || [matchattr [nick2hand $nick] o] || [matchattr [nick2hand $nick] f]} {return 0}
    global qot qot_flood_array ; if {$qot(flood_num) == 0} {return 0} ; set i [expr $qot(flood_num) - 1]
    while {$i >= 1} {set qot_flood_array($i) $qot_flood_array([expr $i - 1]) ; incr i -1} ; set qot_flood_array(0) [unixtime]
    if {[expr [unixtime] - $qot_flood_array([expr $qot(flood_num) - 1])] <= $qot(flood_time)} {putlog "Quotes - Flood detected from $nick. Ignoring for $qot(ignore_time) minutes." ; if {$qot(ignore)} {newignore [maskhost [getchanhost $nick]] Quote-TCL "$nick flooded the quote script." $qot(ignore_time)} ; return 1
    } {return 0}
}

# moretools stuff. reason why they're here is to make the script easier for people to load. from mc.moretools1.2.tcl by MC_8

proc strip:color {ar} {
   set argument ""
   if {![string match *\003* $ar]} {return $ar} ; set i -1 ; set length [string length $ar]
   while {$i < $length} {
    if {[string index $ar $i] == "\003"} {
     set wind 1 ; set pos [expr $i+1]
     while {$wind < 3} {
      if {[string index $ar $pos] <= 9 && [string index $ar $pos] >= 0} {
       incr wind 1 ; incr pos 1} {set wind 3
      }
     }
     if {[string index $ar $pos] == "," && [string index $ar [expr $pos + 1]] <= 9 &&
         [string index $ar [expr $pos + 1]] >= 0} {
      set wind 1 ; incr pos 1
      while {$wind < 3} {
       if {[string index $ar $pos] <= 9 && [string index $ar $pos] >= 0} {
        incr wind 1 ; incr pos 1} {set wind 3
       }
      }
     }
     if {$i == 0} {
      set ar [string range $ar $pos end]
      set length [string length $ar]
     } {
      set ar "[string range $ar 0 [expr $i - 1]][string range $ar $pos end]"
      set length [string length $ar]
     }
     set argument "$argument[string index $ar $i]"
    } {incr i 1}
   }
   set argument $ar
   return $argument
}

proc strip:bold {ar} {
   set argument ""
   if {[string match *\002* $ar]} {
    set i 0
    while {$i <= [string length $ar]} {
     if {![string match \002 [string index $ar $i]]} {
      set argument "$argument[string index $ar $i]"
     } ; incr i 1
    }
   } {set argument $ar}
   return $argument
}

proc strip:uline {ar} {
   set argument ""
   if {[string match *\037* $ar]} {
    set i 0
    while {$i <= [string length $ar]} {
     if {![string match \037 [string index $ar $i]]} {
      set argument "$argument[string index $ar $i]"
     } ; incr i 1
    }
   } {set argument $ar}
   return $argument
}

proc strip:reverse {ar} {
   set argument ""
   if {[string match *\026* $ar]} {
    set i 0
    while {$i <= [string length $ar]} {
     if {![string match \026 [string index $ar $i]]} {
      set argument "$argument[string index $ar $i]"
     } ; incr i 1
    }
   } {set argument $ar}
   return $argument
}

proc strip:all {ar} {
# return [strip:reverse [strip:uline [strip:bold [strip:color $ar]]]]
   return [strip:reverse [strip:uline [strip:color $ar]]]
}

proc bold {} {return \002}
proc reverse {} {return \026}
proc color {} {return \003}
proc underline {} {return \037}

#moretools stuff end#

proc qot_help {nick uhost hand chan rest} {
   global qot
   putmsg $nick "LCQuote $qot(vershort)."
   putmsg $nick "Все команды используются только на канале."
   putmsg $nick "!ц <номер> - Показывает произвольную цитату или с заданным номером."
   putmsg $nick "!+ц <текст> - Добавляет цитату в базу. Доступ: глобал/канал +o."
   putmsg $nick "!-ц <номер> - Удаляет цитату с заданным номером. Доступ: глобал/канал +o."
   putmsg $nick "!findquote <слово> - Ищет цитаты с заданным словом, и высылает результат по DCC."
   putmsg $nick "!цитата - Показывает последнюю добавленную цитату."
   putmsg $nick "!getquotes - Высылает пользователю базу цитат канала."
   putmsg $nick "!getlqscript - Высылает пользователю tcl скрипт."
    putlog "Quotes: $chan - $nick запросил помощь."
}

proc qot_random {nick uhost hand chan rest} {
      global qot
      if {[qot_flood $nick $uhost $chan]} {return 0}
      if {[qot_fi $chan]} {return 0}
      set qot_fd [open $qot(file)$chan.txt r]
      for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt 1 } {
   gets $qot_fd qot_list($qot_cnt)
      }
      close $qot_fd
      if {$rest==""} {
      set qot_cnt [expr $qot_cnt - 1]
      if {$qot_cnt == 0} {   
      putmsg $chan "$qot(noqn)"
      return   
      }
      putmsg $chan "\[[bold][expr $qot_cur + 1]\/[expr $qot_cnt][bold]\]: $qot_list([set qot_cur [rand [expr $qot_cnt]]])"
      } else {   
      if {[string is integer $rest]} {
      set qot_cnt [expr $qot_cnt - 1]
      unset qot_list([expr $qot_cnt])
      if {![info exists qot_list([expr {$rest} - 1])]} {
          putmsg $chan "$qot(noqn)"
          return
      } else {
      putmsg $chan "\[[bold]$rest\/[expr $qot_cnt][bold]\]: $qot_list([expr {$rest} - 1])"
      return }}}
      putlog "Quotes: $chan - $nick запросил цитату."
}

proc qot_fi {chan} { global qot ; if {![file exists $qot(file)$chan.txt]} { putmsg $chan "$qot(qfn)" ; return 1 } else { return 0 } }

proc qot_src {nick uhost hand chan rest} {
      global qot
      set checked [check_string $rest]
      if {[qot_flood $nick $uhost $chan]} {return 0}
      set qot_src(file) "quotesearch-results.txt"
      catch { exec grep -i -n "$checked" $qot(file)$chan.txt > $qot_src(file) }
      if {[file size $qot_src(file)] == 0} {
      putmsg $chan "$nick, ничего не найдено."
      exec rm $qot_src(file)
      return
      }
      putmsg $nick "Результаты поиска отправлены по DCC."
      dccsend $qot_src(file) $nick
      exec rm $qot_src(file)
      putlog "Quotes: $chan - $nick получает цитаты с $rest."   
      return   
}

proc qot_addquote {nick uhost hand chan rest} {
      global qot
      set stripped [strip:all $rest]
      if {$hand == "*"} { set hn \[$nick\] } else { set hn \[$hand\] }
      set i 0
      set boldz 0
      while {$i <= [string length $stripped]} {
      if {[string match \002 [string index $stripped $i]]} {incr boldz 1}
      incr i 1
      }
      if {[expr $boldz%2] == 0} {} else { set hn "[bold]$hn" }
      set stripped "$stripped $hn"
      if {[string length $stripped] < 1} { return 0 }
      set qot_fd [open $qot(file)$chan.txt a+]
      puts $qot_fd $stripped
      close $qot_fd
      putnotc $nick "Цитата с $chan добавлена в базу."
      putlog "Quotes: $chan - $nick добавил цитату."
      return
}

proc qot_del {nick uhost hand chan rest} {
      global qot
      if {[qot_fi $chan]} {return 0}
      set delnum $rest
      set type [lindex $rest 0]
      set rest [lrange $rest 1 end]
      set qot_fd [open $qot(file)$chan.txt r]
      for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt 1 } {
   gets $qot_fd qot_list($qot_cnt)
      }
      close $qot_fd
      set qot_cnt [expr $qot_cnt - 2]
      if {[string is integer $delnum]} {
          set qot_fd [open $qot(file)$chan.txt w]
          for { set i 0 } { $i <= $qot_cnt } { incr i 1 } {
       if {($qot_list($i) == "") || ($i == [expr $delnum - 1])} {
    putmsg $chan "Цитата [expr $i + 1] удалена."
                  putlog "Quotes: $chan - $nick удалил цитату $delnum."
    continue                  
       } else {
    puts $qot_fd $qot_list($i)
       }
   }
   close $qot_fd
      }
      return
}

proc qot_get {nick uhost hand chan args} {
      global qot
      if {[qot_flood $nick $uhost $chan]} {return 0}
      if {[string length $args] > 0} { set gc $args } else { set gc $chan }
      putlog "Quotes: $chan - $nick запросил базу с цитатами $gc."
      putnotc $nick "База послана по DCC"
      dccsend $qot(file)$gc.txt $nick
      return
}

proc qot_script {nick uhost hand chan args} {
      global qot
      if {[qot_flood $nick $uhost $chan]} {return 0}
      putlog "Quotes: $chan - $nick запросил скрипт."
      putnotc $nick "Скрипт выслан по DCC."
      dccsend $qot(package) $nick
      return   
}

proc qot_last {nick uhost hand chan arg} {
      global qot
      if {[qot_flood $nick $uhost $chan]} {return 0}
      if {[qot_fi $chan]} {return 0}
      set qot_fd [open $qot(file)$chan.txt r]
      for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt } {
          gets $qot_fd qot_list($qot_cnt)
      }
      close $qot_fd
      set qot_cnt [expr $qot_cnt - 2]      
      set qot(last) $qot_list([expr $qot_cnt])
      putmsg $chan "Последняя цитата ([bold][expr $qot_cnt + 1][bold]): $qot(last)"
      return   
}

putlog "LCQuote 1.00 by lmrvsk@RusNet succesfully loaded."


Вроде бы последняя строка выводит...
Vladislav 24.02.12 20:27 #123
Code
if {$hand == "*"} { set hn \[$nick\] } else { set hn \[$hand\] }


Эта строка в процедуре добавления цитаты, походу о формате тут речи не идёт. Можешь добавить в неё, но действовать будет только для новых цитат.

Quote
if {$hand == "*"} { set hn \[Добавил $nick\] } else { set hn \[Добавил $hand\] }
Corund 24.02.12 22:15 #124
Спасибо!

Вот так получилось - еще пробел надо было экранировать.

Code
    if {$hand == "*"} { set hn \[Добавил\ $nick\] } else { set hn \[Добавил\ $hand\] }


А старые цитаты просто подправил в базе, теперь все ок.

Хороший скрипт кстати. Включите в следующую сборку)
Vladislav 24.02.12 23:04 #125
Что-то такое уже есть:

Quote
<Vladislav> !+ц тестовая цитата
-Windrop- Цитата добавлена (номер 1).
<Vladislav> !ц
<Windrop> [1/1] тестовая цитата [Vladislav 24-02-2012 23:01:31]
<Vladislav> !-ц 1
-Windrop- Удалена цитата номер 1.
Chrome 07.03.12 10:24 #126
Владислав, если такой скрипт который бы забирал инфо об юзере с сайтов юкоза? Под информацией имею ввиду: ранг титул кол ссообшений? Заранее спасибо
Vladislav 07.03.12 11:14 #127
Такого скрипта нет
Chrome 07.03.12 13:50 #128
Я покончу жизнб самоубийством пытаясь его написать...
Vladislav 08.03.12 12:13 #129
Верно, не самый простой скрипт будет, надо будет с начало ввести в поиск пользователей нужный ник затем посетить страничку по найденной ссылке, профиль часто меняют на юкозвоских сайтах, да и на многих нужна регистрация чтобы посмотреть чей-то профиль, а пользы ни какой от этого скрипта)
Dudast 05.04.12 22:15 #130
как сдеалть скрипт чтоб свой txt анекдот показывал а не взял баз с сайта?
Vladislav 05.04.12 22:35 #131
В гугле поискать anekdot.tcl он выводит из текстовой базы.
making 25.05.12 13:59 #132
нужен скрипт, чтоб бот на канале, банил входящих людей, которые сидят с определённого сервера
Vladislav 25.05.12 17:17 #133
Используй регулярный бан, пример тут.
zxcv 30.05.12 07:15 #134
Как вывести версию irc клиента определенного юзера на канал?
Vladislav 30.05.12 09:30 #135
Code
set ctcpuse 0; set ctcpchan ""

bind pub - !версия ctcpverpub
proc ctcpverpub {nick uhost hand chan text} {
global ctcpuse ctcpchan
if {[string is space $text]} {putserv "NOTICE $nick :Формат: $::lastbind <ник>"; return}
set ctcpuse 1; set ctcpchan $chan
putserv "PRIVMSG [lindex [split $text] 0] :\001VERSION\001"
}

bind ctcr - VERSION ctcpverctcr
proc ctcpverctcr {nick uhost hand dest keyword text} {
global ctcpuse ctcpchan
if {$ctcpuse == 1} {putserv "PRIVMSG $ctcpchan :$nick -> $text"; set ctcpuse 0}
}
Форум » Основной раздел » Мастерская » Вопросы по скриптам
Поиск: