mIRC Homepage
Posted By: NFNAlexx Random Generator? - 19/12/14 08:11 AM
How do get my bot to react in a random generator. I know it's possible to do with numbers but I want to do it with words for example what I have now is

on *:TEXT:!slap:#: { msg $chan /me challenges you to a slap fight you }

and it will appear saying Nin10dohBot challenges you to a slap fight you

Now that is the issue I want it to be randomize and have two different outcomes when ever !slap triggers the bot so i want one where it says

Nin10dohBot challenges you to a slap fight you win and stand over the bot triumphantly after winning the battle.

or

Nin10dohBot challenges you to a slap fight you lose and the bot continues to slap you silly with a giant trout.

Can anyone help me with the script?
Posted By: Belhifet Re: Random Generator? - 19/12/14 08:23 AM
Code:
on *:TEXT:!slap:#: {
var %r $rand(1,2)
if (%r == 1) { .msg $chan /me challenges you to a slap fight you win and stand over the bot triumphantly after winning the battle. }
elseif (%r == 2) { .msg $chan /me challenges you to a slap fight you lose and the bot continues to slap you silly with a giant trout. }
}
Posted By: NFNAlexx Re: Random Generator? - 19/12/14 08:26 AM
thank you so much!
Posted By: Panda Re: Random Generator? - 19/12/14 08:45 AM
This, very basically, does what you need it to, I think smile

Code:
on *:TEXT:!slap:#: {
  var %randomslap = $rand(1,2)
  if (%randomslap == 1) {
    .describe $chan challenges you to a slap fight you win and stand over the bot triumphantly after winning the battle.
  }
  elseif (%randomslap == 2) {
    .describe $chan challenges you to a slap fight you lose and the bot continues to slap you silly with a giant trout.
  }
}

Hope this helps smile ... you can add more outcomes and increase the $rand(1,2) to, for example, $rand(1,5) for 5 random options.

Panda

Ack. Belhifet got his solution in as I was typing lol ... sorry Belhifet!!
© mIRC Discussion Forums