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-10If 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 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.
;================================================
; 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 #######################
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!
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?
@ 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>
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
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
You can try other identifiers :)
Regarding $snick, ask mr Help what that is ;)
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
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
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.