xTalker v1.01

By xDaeMoN on Dec 19, 2006

A script I made before for my bot, which was originally a dictionary script but decided to make it give random replies on a certain word or phrase. Copy/paste to a new remote file (ALT-R -> File -> New).

Commands (Only Ops):

!xtalker (on|off) - to Enable/Disable the script
!addtalk (word):(random message) - to add a word & random message *
!deltalk (word)[:random message] - to delete a word/random message **
!findtalk (word) - to find a word in the DB
!showtalk (word|number) - to show the random messages on a word or show the word when a number is given
!counttalk - to count the # of words in the DB

() = required
[] = optional

  • Current identifiers that can be used:

    = the /describe command (i.e. sings abcd...) = the bot's nick = whoever triggers the word = random nick on the channel = random number from 1-10
  • If you want to add more identifiers, it's listed on the bottom of the script. Just follow the current format. If you have doubts, ask mR. Help (/help $replace).

  • You can add another random message by typing the same syntax, just change the message
    ** If you supply a random message, then the random message for that word would be deleted instead of the word

*** You can also change the trigger, output command & target & even exclude channels you don't want this to work. Check the top part of the script.

**NOTE: You can also use wildcards on the word or phrase.

Changes:
1.13.2010 - identifier now works.

  • Message output would now be sent via the command/target indicated on the output.com/out.to aliases.
;================================================
;  xTalker v1.01
;  Written by: xDaeMoN
;  Email: xdaemon@xdaemon.us
;  1.13.2010
;================================================

;####################### EDIT HERE #######################

alias -l trigger return !
alias -l output.com return msg
alias -l output.to return $chan
alias -l exchans return #Channel_to_exclude_1,#Channel_to_exclude_2

;####################### EVENTS #######################

On *:START: {
  hmake $tbl 100
  if ( $isfile($tbl.log) ) hload $tbl $tbl.log
}

on *:DISCONNECT: hsave -o $tbl $tbl.log
on *:EXIT: hsave -o $tbl $tbl.log

On *:ACTION:*:#: {
  var %e
  if ( %rtalker ) && ( !$istok($exchans,$chan,44) ) {
    ;tokenize 32 $strip($1-)
    if ( $hfind($tbl,$rword($1-).2,1,W) ) { 
      %e = $rtalk($hget($tbl,$v1))
      goto next
    }
    elseif ( $hget($tbl,$rword($1-).2) )  {
      %e = $rtalk($v1)
      :next
      inc $iif(!%rtalkerflood,-u60) % $+ rtalkerflood
      if ( %rtalkerflood < 5 ) $+(.timer,$cid,$chan,$tbl) 1 2 $iif(<act> == $gettok(%e,1,32), $($rword(%e).1,2),$output.com $output.to $($rword(%e).1,2))
    }
  } 
}

On *:TEXT:*:#: {
  var %e
  if ( %rtalker ) && ( !$istok($exchans,$chan,44) ) {
    ;tokenize 32 $strip($1-)
    if ( $hfind($tbl,$rword($1-).2,1,W) ) { 
      %e = $rtalk($hget($tbl,$v1))
      goto next
    }
    elseif ( $hget($tbl,$rword($1-).2) )  {
      %e = $rtalk($v1)
      :next
      inc $iif(!%rtalkerflood,-u60) % $+ rtalkerflood
      if ( %rtalkerflood < 5 ) $+(.timer,$cid,$chan,$tbl) 1 2 $iif(<act> == $gettok(%e,1,32), $($rword(%e).1,2),$output.com $output.to $($rword(%e).1,2))
    }
  } 
  if ( $nick isop $chan ) {
    if ( $1 == $trigger $+ addtalk) {
      if ( $2 ) {
        tokenize 58 $2-
        if ( $2 ) {
          var %q = $rword($1).2
          rtalk.add %q $addtok($hget($tbl,%q),$2-,157)
          $output.com $output.to ** Added random message to $+(',$rword(%q).2,') 

        }
        else $output.com $output.to Syntax: $trigger $+ addtalk <word>:<message>
      }
      else $output.com $output.to Syntax: $trigger $+ addtalk <word>:<message>
    }
    elseif ( $1 ==  $trigger $+ xtalker ) {
      set %rtalker $iif($2 == on,1,0)
      msg $chan $iif(%rtalker,Enabled,Disabled) xTalker
    }
    elseif ( $1 ==  $trigger $+ deltalk ) {
      if ( $2 ) {
        tokenize 58 $2-
        if ( $2 ) {
          if ( $hget($tbl,$rword($1).2) ) {
            var %r = $v1
            if ( $istok(%r,$2,157) ) { 
              rtalk.add $rword($1).2 $remtok(%r,$2,1,157)
              $output.com $output.to Removed $+(',$2,') from: $1
            }
            else $output.com $output.to $+(',$2,') is not listed as a message for: $1
          }
          else $output.com $output.to $+(',$1,') is not in my database.
        }
        else {
          var %w = $rword($1).2
          if ( !$hget($tbl,%w) ) $output.com $output.to $+(',%w,') is not in my database.
          else {
            hdel $tbl %w
            $output.com $output.to ** Deleted $+(',$rword(%w).2,') in the database.
          }
        }
      }
      else $output.com $output.to Syntax: ** $trigger $+ deltalk <word>[:message]
    }
    elseif ( $1 == $trigger $+ showtalk ) {
      if ( $2 isnum ) {
        if ( $2 isnum $+(1-,$hget($tbl,0).item) ) $output.com $output.to Word $+($chr(35),$2,:) $hget($tbl,$2).item
        else $output.com $output.to There is no Word $+($chr(35),$2,.) There are $hget($tbl,0).item words in my database.
      }
      else {
        var %w = $rword($2-).2
        if ( !$hget($tbl,%w) ) $output.com $output.to $+(',%w,') is not in my database.
        else $output.com $output.to $rword(%w).2 $+ : $hget($tbl,%w)
      }
      else $output.com $output.to Syntax: ** $trigger $+ showtalk <word>
    }
    elseif ( $1 == $trigger $+ findtalk ) {
      if ( $2 ) {
        var %w = $rword($2).2, %wd = $hfind($tbl,$+(*,%w,*),0,w), %wk
        if ( !$hfind($tbl,$+(*,%w,*),0,w) ) $output.com $output.to $+(',%w,') is not in my database.
        else { 
          if ( %wd < 10 ) {
            while %wd {
              %wk = $addtok(%wk,$rword($hfind($tbl,$+(*,%w,*),%wd,w)).2,157)
              dec %wd
            }
            $output.com $output.to Found $hfind($tbl,$+(*,%w,*),0,w) words: %wk
          }
          else .notice $nick Too many results. Please refine your search.
        }
      }
      else $output.com $output.to ** Syntax: $trigger $+ findtalk <word>
    }
    elseif ( $1 == $trigger $+ counttalk ) { 
      if ( $2 ) {
        if ( $2 isnum $+(1-,$hget($tbl,0).item) ) $output.com $output.to Item $chr(35) $+ $2 is $rword($hget($tbl,$2).item).2
        else $output.com $output.to There is no item $chr(35) $+ $2
      }
      else $output.com $output.to There are $hget($tbl,0).item words in my database.
    }
  }
}

;####################### ALIASES #######################

alias xtalker.version return 1.01
alias -l rtalk return $gettok($1-,$r(1,$numtok($1-,157)),157)
alias -l tbl return xTalker
alias -l tbl.log return $tbl $+ .dat
alias -l rtalk.add { hadd -m $tbl $1- | hsave -o $tbl $tbl.log }
alias -l rword { 
  if ( $prop == 1 ) return $replace($1-,<me>,$!me,<nick>,$!nick,<randnick>,$nick(#,$r(1,$nick(#,0))),<randnum1-10>,$r(1,10),<act>,describe $!output.to)
  elseif ( $prop == 2 ) { 
    if ( _ isin $1- ) return $replace($1-,_,$chr(32)) 
    else return  $replace($1-,$chr(32),_)
  }
}

;####################### EOF #######################

Comments

Sign in to comment.
LonesomeRanger   -  Jan 06, 2012

This problem seems to be solved now
My bots mIRC was 6.12
FordLawnmower commented on my other comment that that problem could be a version issue.
Changing the mIRC to version 6.16 didn't solve that problem, but it solved this one!
Now it seems to work fine!
Thanks @FordLawnmower for pointing out the possible version issue!

 Respond  
LonesomeRanger   -  Jan 05, 2012

I'm a bit of a beginner when it comes to coding.
But I have put this script in my bots remotes and did a

!addtalk cookie:<act> loves chocolate biscuits!

Now when I say 'cookie' in channel nothing happens, in my bots status window I get this:

  • /msg: insufficient parameters

Anybody know how I solve this?

 Respond  
Slyvar   -  Nov 09, 2010

thanks xDaeMoN
it's working now and now its Great Script

Million Thanks

:D

 Respond  
xDaeMoN   -  Nov 08, 2010

@ Slyvar: Yes you can. You also need to add a variable to the "rword" alias at the very end of the script so it would replace the word.

On the "rword" alias, find the line

  if ( $prop == 1 ) return $replace($1-,<me>,$!me,<nick>,$!nick,<randnick>,$nick(#,$r(1,$nick(#,0))),<randnum1-10>,$r(1,10),<act>,describe $!output.to)

then we need to add $6 which would trigger the 6th token/word said. The new line would be

  if ( $prop == 1 ) return $replace($1-,<me>,$!me,<nick>,$!nick,<randnick>,$nick(#,$r(1,$nick(#,0))),<randnum1-10>,$r(1,10),<act>,describe $!output.to,<6>,$!6)

Then now, you need to add a phrase, type

!addtalk hey BOT say hi to &:hello <6>
 Respond  
Slyvar   -  Nov 02, 2010

Hey i know this is old but do you know if i can make it do like this

Owner: hey BOT say hi to SAM

BOT : HELLO SAM

 Respond  
xDaeMoN   -  Jan 25, 2010
  1. type
/hfree xtalker

if you have your mirc open.

OR

  1. If you don't have your mirc open, find the file "xtalker.dat" and delete it.
 Respond  
bugboy1028   -  Jan 25, 2010

Also, it fail after i try 2 randnumb
How can i remove the log that is used by this script
tell me how please?

 Respond  
bugboy1028   -  Jan 25, 2010

script suddenlty stop working ! IT dont relazied new words

 Respond  
xDaeMoN   -  Jan 25, 2010

I believe you can.

 Respond  
bugboy1028   -  Jan 24, 2010

can you set kick / ban?

 Respond  
Pangaea   -  Jan 20, 2010

xDaeMoN

sorry i missed your reply.

Thankyou yet again, did you relise when you first thought of this script how powerful it actuly is? Im mean you can quite litterly make channel tools and even basic games, and all programmable with in chan triggers. While ive been giving ppl on chan tutorials about using this, a few have remarked that they now have taken an interest in mirc scripting in general. If hawkee had a top scripts of the year, this would surely be in the running.

the title "X-talker" dose not give this juctice.

endless regards
pan

 Respond  
xDaeMoN   -  Jan 18, 2010

Try something like this:

!addtalk !checkhost*:I am $me $+ . you are $nick $+ . host of $2 is $address($2,5) $+ . Today is $fulldate $+ .

Then type

!checkhost other_nick_here
  • as long as other_nick_here is on any of the bot's channel, the script will pick up the full address of the other user.

You can try other identifiers :)

Regarding $snick, ask mr Help what that is ;)

 Respond  
Pangaea   -  Jan 14, 2010

xDaeMoN
wonderful stuff, this script just got a whole lot better.

For the benifit of others i have a link to a page with wildcard / identifiers.
I have found alot more wildcard and identifiers that can be used with this, this page is a bit messy, but you can experiment with alot of them.

http://www.mirc.com/faq7.html#section7-1-3

Just a thought while I was experimenting that ide like to ask anyone.
Some of these wild cards are "self" initialised and others are getting info from other nicks. (im probably not explaining this right) so ill give you an example.

if i were to add this
!addtalk .checkhost:hi $nick the host address is $address
this would return the bots host address, now is it possible to make the bot read another address?. somthing like
!addtalk .checkhost (?):hi $nick (?)`s host address is $address(?)

so in a sence, im using the $address as an example,but there are other wildcards that could use the same method, such as $time.

Im alittle confused what $snick dose , perhaps this is the key?

anyway, A few folks are using this script and its a huge hit with them, one guy mentioned he may edit the script so it writes to a text pad line by line (easyer to read and edit the records).. and or make dialougs to view / edit / del..etc records.
If this dose materialise I will promtly post in here.

Thanks again xDaeMoN, and to all the other folks that supplied some hints and tips on this one.

regards
pan

 Respond  
xDaeMoN   -  Jan 14, 2010

I fixed the script for the action part. The identifier was already there, though the command was missing. I also listed the identifiers that you can use, check the intro above.

@ Pangaea, you can do

*t*r*igg*er:<act> is hungry like a wolf
 Respond  
Pangaea   -  Jan 12, 2010

Hey folks

This is one of thee most popular tools im running now, the fact that ops can add in stuff is great too. I have been experimenting with various wildcards, but Ide really like to know if anyone has a full list of them, that can be specificly used with this.
So far I have worked out these:

Trigger word or sentence
Trigger word or sentence
Trigger word or sentence

Trigger word or sentence

responces:
$nick - returns the users nick (person who used the trigger)
$2 - "and this"
$chan "channel name"
$time "time"
$date "date"
$day "day"
$me "bot/script client nick"

bugboy1028 mentioned about having this either respond to a channel action or respond use a channel action. Ive tryed just about everything to get this to work, cant seem to work it out

ive tryed this
trig:/describe text
trig:.describe text
trig:/describe $chan text
trig:/.describe $chan text
trig:/me text
trig:.me text
trig:/me $chan text
trig:.me $chan text
trig:$descibe text
trig:$me $descibe text
trig:$descibe $chan text
trig:$me $descibe $chan text

etc.. also as mentioned above i cant get this to respond to actions either.
anyone got any ideas?

regards
pan

 Respond  
Jethro   -  Jan 05, 2010

if i want to do 2 nicks for that, what i do?

if ( $nick isop $chan ) || ( $istok(bugboy1028 nick2,$nick,32 ) ) {

Change nick2 to the real one. Remember there is a space between your nick and nick2.

 Respond  
bugboy1028   -  Jan 05, 2010

if i want to do 2 nicks for that, what i do?

 Respond  
sunslayer   -  Jan 05, 2010

Pangaea, how i make it chose random person in the room?

$nick(#,$r(1,$nick(#,0)))
 Respond  
Jethro   -  Jan 05, 2010

Oh ok. Then don't remove it. But change it to this one:

if ( $nick isop $chan ) || ( $nick == bugboy1028 ) {

I put bugboy1028 there. Replace it with your actual channel nickname.

 Respond  
bugboy1028   -  Jan 05, 2010

then i have to remove bracket from line 138,

But i want it listen to me AND the op

 Respond  
Jethro   -  Jan 05, 2010

Remove this line of code:> if ( $nick isop $chan ) {

 Respond  
bugboy1028   -  Jan 05, 2010

re-add it.....
It's working again.

Any way that it will respond to me EVEN IF I AM NOT OP?

 Respond  
bugboy1028   -  Jan 05, 2010

now it's not wokring on my mIRC
i just deleted it

 Respond  
Pangaea   -  Jan 05, 2010

Hi, bugboy1028

Im not the autor of this script, ude be better asking xDaeMoN

however what your talking about wont work with this script, and i can imagine it would take some work to make it possible to respond to random nicks... there are other scripts on hawkee that might help you make this script do that.

 Respond  
bugboy1028   -  Dec 31, 2009

Pangaea, how i make it chose random person in the room?

 Respond  
Pangaea   -  Dec 27, 2009

SORRY POSTED THIS INTO THE WRONG THREAD PLEASE IGNORE

 Respond  
Pangaea   -  Dec 27, 2009

not sure bugboy1028.. i tryed a few things cant seem to get it to action the channel. experiment your self. and btw code for an action is "describe"

 Respond  
bugboy1028   -  Dec 26, 2009

what about Action stuff like /me?

 Respond  
Pangaea   -  Dec 26, 2009
!addtalk 55555:random 1 $nick ** Added random message to '55555' 55555 random 1 Pangaea quality script, tnx
 Respond  
bugboy1028   -  Dec 12, 2009

can you put in $nick stuff too so bot will respond back?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.