mIRC Homepage
Posted By: lukar14 [Twitch] Add quote not working? - 31/07/15 02:25 AM
So I'm very, very new to coding and have absolutely no experience at all. I've come to understand the very basic stuff in mIRC, but somethings I'm just not getting. I've managed to make a custom twitch chat bot using tutorials on youtube and have got it working for the most part. I just can't seem to get !addquote or !addjoke to work. I had them working originally and all they would add was the first word of the sentence that I would type. No they aren't working at all.
The code I'm using is:
Code:
on *:TEXT:!addquote *:#: {
  if ($nick !isOp #) { return }
  write quotes.txt $2- $+
  msg $chan Added: $2-
}


Edit: I should also mention that it is not automatically adding the quote.txt file. And when added manually, it will still not recognize or write into that file.

Any advice or help would be greatly appreciated!
Thank you!
Posted By: dailyproblem Re: [Twitch] Add quote not working? - 31/07/15 05:45 AM
Code:
 
on *:text:!addquote *:#: {
  if ($nick isop #) {
    var %r = $read(quote.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This quote $qt($2) is quote exist into the database! | return }
    write quote.txt $2-
    msg $chan /me + quote $2 has been added to the database!
  }
}
on *:text:!delquote *:#: {
  if ($nick isop #) {
    var %r = $read(quote.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This quote $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn quote.txt
    msg $chan /me - Quote $2- has been deleted from the database!
  }
}
on *:text:!editquote & *:#: {
  if ($nick isop #) {
    var %r = $read(quote.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This quote $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn quote.txt $2-
    msg $chan /me -> Quote $2 has been updated!
  }
}
ON *:TEXT:*:#: { 
  tokenize 32 $strip($1-,burci)
  if ($read(quote.txt, nts, $1)) {
    var %com = $v1
    var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan  | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}

This is a modified version of my !addcom !editcom !delcom script. It should work with what you want. With the ability to both delete and edit your quotes, in case of mistakes! (If it does not work, sorry I am tired!
Posted By: Nillen Re: [Twitch] Add quote not working? - 31/07/15 12:07 PM
There's also one I made a while ago found here if you'd like to try that out.
Posted By: lukar14 Re: [Twitch] Add quote not working? - 31/07/15 12:26 PM
So I've tried both scripts and still neither are creating the quotes.txt file or even being recognized by the bot when I type in chat. Is there something I'm still not doing right?
Posted By: Nillen Re: [Twitch] Add quote not working? - 31/07/15 02:20 PM
Are you using it all in the same remote script file? Create a new file by going to File > New while in the script editor, then paste it there.
Posted By: lukar14 Re: [Twitch] Add quote not working? - 31/07/15 02:29 PM
I think that I am. I'm using mSLDev to edit scripts, but I have tried pasting directly into mIRC and it's still not being recognized.
Posted By: MattiSony Re: [Twitch] Add quote not working? - 31/07/15 04:05 PM
Are you requesting the user list? - https://forums.mirc.com/ubbthreads.php/topics/254093/
Posted By: lukar14 Re: [Twitch] Add quote not working? - 01/08/15 12:59 AM
Thank you! I think that did the trick!
Thanks everyone for their help!
© mIRC Discussion Forums