mIRC Home    About    Download    Register    News    Help

Print Thread
#256489 19/01/16 08:10 PM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
Hello,

I need help with my 8ball script, to make it as when the user doesn't use ? after the question, my bot will respond:
Code:
Your question either didn't end with a "?", or is too long.


This is my whole code for the script:
Code:
on *:text:!8ball ?*:#yznb: {
  if ((%flood8ball) || ($($+(%,flood8ball.,$nick),2))) { return }
  set -u40 %flood8ball On
  set -u120 %flood8ball. $+ $nick On
  var %r $r(1,20)
  if (%r == 1) {
    /describe $chan @ $+ $nick $+ , It is certain.
  }
  if (%r == 2) {
    /describe $chan @ $+ $nick $+ , No. danNo
  }
  if (%r == 3) {
    /describe $chan @ $+ $nick $+ , YES PogChamp
  }
  if (%r == 4) {
    /describe $chan @ $+ $nick $+ , Without a doubt.
  }
  if (%r == 5) {
    /describe $chan @ $+ $nick $+ , Yes, of course.
  }
  if (%r == 6) {
    /describe $chan @ $+ $nick $+ , No way in hell.
  }
  if (%r == 7) {
    /describe $chan @ $+ $nick $+ , Keep dreaming baby.
  }
  if (%r == 8) {
    /describe $chan @ $+ $nick $+ , Most likely.
  } 
  if (%r == 9) {
    /describe $chan @ $+ $nick $+ , Concentrate and ask again.
  } 
  if (%r == 10) {
    /describe $chan @ $+ $nick $+ , Wait a few seconds. danWait
  } 
  if (%r == 11) {
    /describe $chan @ $+ $nick $+ , Take it easy, pleb.
  } 
  if (%r == 12) {
    /describe $chan @ $+ $nick $+ , Outlook good.
  } 
  if (%r == 13) {
    /describe $chan @ $+ $nick $+ , Yes. Kappa
  } 
  if (%r == 14) {
    /describe $chan @ $+ $nick $+ , Cannot predict your answer right now.
  } 
  if (%r == 15) {
    /describe $chan @ $+ $nick $+ , I wouldn't count on it.
  } 
  if (%r == 16) {
    /describe $chan @ $+ $nick $+ , Maybe. BrokeBack
  } 
  if (%r == 17) {
    /describe $chan @ $+ $nick $+ , My answer is your answer.
  } 
  if (%r == 18) {
    /describe $chan @ $+ $nick $+ , Look inside your heart, and you'll find the answer.
  } 
  if (%r == 19) {
    /describe $chan @ $+ $nick $+ , xanRight Yes.
  } 
  if (%r == 20) {
    /describe $chan @ $+ $nick $+ , It's doubtful.
  } 
}
on *:text:!8ball *:#artiiz: {
  if ((%flood9ball) || ($($+(%,flood9ball.,$nick),2))) { return }
  set -u0 %flood9ball On
  set -u0 %flood9ball. $+ $nick On
  msg $chan @ $+ $nick $+ , Your question either didn't end with a "?", or is too long.
}


Everything works fine, besides that you can ask a question without having "?" at the end, and the bot will still response with one of the answer.

I don't know how to make it so that whenever a person doesn't use ? after the !8ball "question", it responds with "Your question either didn't end with a "?", or is too long.".

Someone that knows the problem?

Thanks!

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
if ($right($1-,1) != ?) { msg # this is not a question | return }

Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
Loki's answer is perfectly valid, but I'm bored, so:

Code:
on *:text:!8ball *:#yznb: {
  if (!%flood8ball) && (!$($+(%,flood8ball.,$nick),2)) {
    inc -z %flood8ball 40
    inc -z %flood8ball. $+ $nick 120
    var %m = It is certain.|No. danNo|YES PogChamp|Without a doubt.|Yes, of course.|No way in hell.|Keep dreaming baby.|Most likely.|Concentrate and ask again.|Wait a few seconds. danWait|Take it easy, pleb.|Outlook good.|Yes. Kappa|Cannot predict your answer right now.|I wouldn't count on it.|Maybe. BrokeBack|My answer is your answer.|Look inside your heart, and you'll find the answer.|xanRight Yes.|It's doubtful.
    if ($right($1-,1) == ?) describe # Your question either didn't end with a "?", or is too long.
    else describe # @ $+ $nick $+ , $gettok(%m,$rand(1,$numtok(%m,124)),124)
  }
}


Link Copied to Clipboard