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.

responder script by MC_8 & Cruz

Support & discussion of released scripts, and announcements of new releases.
Post Reply
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

responder script by MC_8 & Cruz

Post by NTHosts »

Ok as the title say i use the responder script by MC_8 & Cruz, my problem is this...
The bot takes like 3 or 4 seconds to post what it is spose to respond..

i.e
<me> !respond
5 seconds later....
<bot> Responce

How could I make this script do an instant responce with no delays ??

Heres the code...

Code: Select all

##
# Global settings:
##

# what channel(s) do you want this to be active on?
set mc_re(chan) {"#\[ftuc\]" "#LynxFM" "#on-air" "#test" "#dj" }

# how many messages may we send...
set messagelimit 500

# in how many seconds?
set timelimit 30

# what color do you want the text to have?
set mc_color ""


##
#Template :
#              read        write
# set {mc_resp(    )}    {"     "}
#
# Valid variables are %nick %uhost %hand %chan ^^^ ###
#

# INFO

set {mc_resp(!web)}    {"http://www.LynxFM.com"}
set {mc_resp(!forum)}    {"http://www.LynxFM.com/main/modules.php?name=Forums"}
set {mc_resp(!downloads)}    {"http://www.LynxFM.com/modules.php?name=Downloads"}
set {mc_resp(!mirc)}    {"http://www.LynxFM.com/modules.php?name=Downloads"}
set {mc_resp(!xchat)}    {"http://www.LynxFM.com/modules.php?name=Downloads"}
set {mc_resp(!listen)}    {"http://www.LynxFM.com/modules.php?name=listen"}
set {mc_resp(!apply)}    {"http://www.LynxFM.com/modules.php?name=apply"}
# LISTEN

set {mc_resp(!winamp)}    {"http://stream.lynxfm.info:8000/listen.pls"}
set {mc_resp(!wmp)}    {"http://www.LynxFM,com/wmp.htm"}
set {mc_resp(!real)}    {"http://www.LynxFM.com/real.ram"}
set {mc_resp(!itunes)}    {"http://stream.lynxfm.info:8000/listen.pls"}


# FUNNY

set {mc_resp(!spliff)}    {"/me rolls a phat joint and chucks it to %nick, try !blunt you puff !"}
set {mc_resp(!blunt)}    {"/me packs a cuban cigar full of skunk and chucks it to %nick... hehe now we're talkin ;)"}
set {mc_resp(!beer)}    {"/me cracks open a cold one and passes it to %nick.. enjoy :)"}
set {mc_resp(!stella)}    {"\0030,12 BIG UP THE STELLA CREW INSIIIIIIDE !!!! "}
set {mc_resp(!work)}    {"will this [censored] thing work ? %chan"}


# SYSTEM

set {mc_resp(!sao)}    {"/msg operserv set superadmin on"}
set {mc_resp(!tag)}    {"/msg operserv svsnick %nick %nick|On-Air"}
set {mc_resp(!away)}    {"/msg operserv svsnick %nick %nick|Away"}
set {mc_resp(!brb)}    {"/msg operserv svsnick %nick %nick|BRB"}
set {mc_resp(!bed)}    {"/msg operserv svsnick %nick %nick|Bed"}
set {mc_resp(!food)}    {"/msg operserv svsnick %nick %nick|Food"}
set {mc_resp(!work)}    {"/msg operserv svsnick %nick %nick|Work"}


# TURN IT UP

set {mc_resp(!tiu)}    {"\00300\o/\o/\o/ \00308Turn it Up \00300\o/\o/\o/"\
                        "\00311CANT \00308HERE \00311IT \00308TURN \00311IT \00308UP !!!"\
                        "\00311TURN IT UP"\
                        "\00302OMFG \00306TURN \00302IT \00306UP \00302MOTHER \00306FUCKER !!!!"\
                        "\00306Dont you know pump it up \00306,7You Gotta pump it up !"\
                        "\00309(((((((( TIU ))))))))"}

# TUNE
set {mc_resp(!tune)}    {"\00315OMFG I LOVE THIS TUNE !!! <3"\
                        "\00309WOOT WOOT WOOT OMGWAFT !!!"\
                        "\00307(\00306(\00307(\00306(\00307(\00306(\00307(\00306(\00307(\00306(\00307(\00306( \00309COME ON L$
                        "\00308((((((((( WORK IT DJ, WORK IT )))))))))"\
                        "\00307T\00308U\00307N\00308E\00307!\00307T\00308U\00307N\00308E\00307!\00307T\00308U\00307N\00308E\0$
                        "\00300,2HEY DJ, SPIN US ANOTHER PHAT TRACK !"}

# HANDS UP

set {mc_resp(!hu)}    {"\00312\o/\00313\o/\00312\o/\00313\o/\00312\o/\00313\o/\00312\o/\00313\o/\00312\o/\00313\o/"\
                        "\00308\o/\00308\o/\00308\o/\00308\o/\00302HANDS UP \00308\o/\00308\o/\00308\o/\00308\o/"\
                        "\00315\o/\00303\o/\00302\o/\00308\o/\00315\o/\00303\o/\00302\o/\00308\o/"}


# SCHEDULE

set {mc_resp(!schedule*sun)}    {"\0034LynxFM schedule for Sunday.\n \01700:00 - 14:00 ~ DJ-LFM\n 14:00 - 16:00 ~ DJ-Steve\n $

set {mc_resp(!schedule*mon)}    {"\0034LynxFM schedule for Monday.\n\01700:00 - 20:00 ~ DJ-LFM\n 20:00 - 22:00 ~ DJ-NTR\n 22:$

set {mc_resp(!schedule*tue)}    {"\0034LynxFM schedule for Tuesday.\n\01700:00 - 20:00 ~ DJ-LFM\n 20:00 - 22:00 ~ ChrissyT\n $

set {mc_resp(!schedule*wed)}    {"\0034LynxFM schedule for Wednesday.\n\01700:00 - 01:00 ~ DJ-LFM\n 01:00 - 06:00 ~ DJ_Alphak$

set {mc_resp(!schedule*thu)}    {"\0034LynxFM schedule for Thursday.\n\01700:00 - 00:00 ~ DJ-LFM\n \0034All times true GMT."}

set {mc_resp(!schedule*fri)}    {"\0034LynxFM schedule for Friday.\n\01700:00 - 17:00 ~ DJ-LFM\n 17:00 - 19:00 ~ ChrissyT\n 1$

set {mc_resp(!schedule*sat)}    {"\0034LynxFM schedule for Saturday.\n\01700:00 - 20:00 ~ DJ-LFM\n 20:00 - 22:00 ~ DJ-NTR\n 2$

set {mc_resp(!schedule)}    {"Please choose which day you want, just the first 3 letters.. such as \"!schedule mon\" will sho$



#                                                       #
### You may stop editing now, source code starts here ###
#                                                       #

set mc_re(version) v2.0
set mc_re(chan) [string tolower $mc_re(chan)]
bind pubm - * mc:resp
bind ctcp - "ACTION" mc:action
bind join - * mc:join

proc mc:join {nick uhost hand chan args} {
#  puthelp "PRIVMSG $chan : $nick / $uhost / $hand / $chan / $args"
# little hack, add the keyword 'onjoin123' as the text so we can use that to trigger on join messages
  set args "$nick onjoin123"
  mc:resp $nick $uhost $hand $chan $args
    return 0
}

proc mc:action { nick uhost hand chan keyword text } {
#  puthelp "PRIVMSG $chan : $nick / $uhost / $hand / $chan / $keyword / $text"
  mc:resp $nick $uhost $hand $chan $text
}


proc mc:resp {nick uhost hand chan args} {
 global botnick mc_resp mc_re messagelimit messagecount timelimit hack mc_color
 set args [string tolower [lindex $args 0]]

 # make sure we're not spamming because we're being spammed:
 if {![info exists messagecount]} {
   set messagecount 0
 }
 if {$messagecount >= $messagelimit} { return 0 }

 # check if we're on a channel which we are installed on:
 if {[lsearch -exact $mc_re(chan) [string tolower $chan]] == "-1"} {return 0}

 # loop through all above responses with the received line:
 # "search" is the received line.
 foreach search [string tolower [array names mc_resp]] {

  # if we have a match:
  # (if "search" (*hello*bob*) matches "args" (why, hello bob!))
  if {[string match $search $args]} {
 if {[string match $search $args]} {

   # put the entire message (bot reply) in the text variable since we'll be using it:
   set text [mc:resp:rep $mc_resp($search) $nick $uhost $hand $chan]

   # pick a random reply if there are multiple defined:
   set alltext [lindex $text [rand [llength $text]]]

   # if the reply contains a \n, split it in multiple commands:
   set alltext [split $alltext "\n"]
   foreach text $alltext {

    # strip any spaces at end or front
    set text [string trim $text]

                # search : *hello*bob*
                # args   : hello bob, good to see you
                # text   : Thanks, it's good to see you too
# lets see if we can assign text to variables:
    regsub -all "\\*" $search "(.\*)" regtext

    set TXT1 "."
    set TXT2 "."
    set TXT3 "."
    set TXT4 "."
    set TXT5 "."
    set TXT6 "."

    regexp $regtext $args match_var TXT1 TXT2 TXT3 TXT4 TXT5 TXT6

    regsub "%1" $text $TXT1 text
    regsub "%2" $text $TXT2 text
    regsub "%3" $text $TXT3 text
    regsub "%4" $text $TXT4 text
    regsub "%5" $text $TXT5 text
    regsub "%6" $text $TXT6 text

#puthelp "PRIVMSG $chan :$TXT1 $TXT2 $TXT3 $TXT4 $TXT5 $TXT6"
#puthelp "PRIVMSG $chan : (regexp   $regtext   $args)"

    # first parse the /me
    if {[string match /me* $text]} {
       regsub "/me " $text "" echotext
       puthelp "PRIVMSG $chan :^AACTION $echotext^A"
       continue
       }

    # second, parse /not
    if {[string match /not* $text]} {
       if {[regexp {^\/not ([^ ]*) (.*)$} $text match_var recipient message]} {
          puthelp "NOTICE $recipient :${mc_color}$message"
          } else {
          puthelp "PRIVMSG $chan :${mc_color}Sorry, i [censored] up. ($text)"
          }
          continue
       }
 # third, parse /msg
    if {[string match /msg* $text]} {
       if {[regexp {^\/msg ([^ ]*) (.*)$} $text match_var recipient message]} {
          puthelp "PRIVMSG $recipient :${mc_color}$message"
          } else {
          puthelp "PRIVMSG $chan :${mc_color}Sorry, i [censored] up. ($text)"
          }
          continue
       }

    # fourth, parse /kick
    if {[string match /kick* $text]} {
       if {[regexp {^\/kick ([^ ]*) (.*)$} $text match_var target message]} {

          if {[isop $target $chan]!=1} {
              puthelp "KICK $chan $target :$message"
            } else {
              puthelp "PRIVMSG $chan :^AACTION nudges $target and points at his boot^A"
            }

          } else {
              puthelp "PRIVMSG $chan :${mc_color}Sorry, i [censored] up. ($text)"
          }
          continue
       }

    # fifth, parse /ban
    if {[string match /ban* $text]} {
       if {[regexp {^\/ban ([^ ]*) ([0-9]+) (.*)$} $text match_var target bantime message]} {

          if {[isop $target $chan]!=1} {
              newchanban $chan [maskhost $uhost] $botnick $message $bantime
              puthelp "KICK $chan $target :$message"
            } else {
              puthelp "PRIVMSG $chan :^AACTION gently asks $target to permanently leave^A"
            }

          } else {
              puthelp "PRIVMSG $chan :${mc_color}Sorry, i [censored] up. ($text)"
  }
          continue
       }


    # default :
    puthelp "PRIVMSG $chan :${mc_color}$text"
    continue
   }

  # update messagecount to prevent flooding
  set messagecount [expr $messagecount+1]
  utimer $timelimit {set messagecount [expr $messagecount-1]}
  return 0

  }
 }
}

proc mc:resp:rep {data nick uhost hand chan} {
 global botnick
 regsub -all -- %nick $data $nick data ; regsub -all -- %uhost $data $uhost data
 regsub -all -- %botnick $data $botnick data
 regsub -all -- %hand $data $hand data ; regsub -all -- %chan $data $chan data
 regsub -all -- %b $data ^B data ; regsub -all -- %r $data ^V data
 regsub -all -- %u $data ^_ data ; regsub -all -- %c $data ^C data
 return $data
}
Any help with this would be great.

Thanks in advance :P
www.NT-Hosts.Net - More than just a host
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

You are using puthelp which is the slowest queue, use a faster queue like putserv or putquick.
r0t3n @ #r0t3n @ Quakenet
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

yay

Post by NTHosts »

Works perfect now :D
Thanks for your fast help :D
www.NT-Hosts.Net - More than just a host
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Re: yay

Post by Alchera »

Lynxfm wrote:Works perfect now :D
Thanks for your fast help :D
Remember 'bugs' referring to MC_8's scripts can (and should be) be directed to here: PureHype Networks
Community Forum


As always, the author of any script is to be contacted first!
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply