mIRC Home    About    Download    Register    News    Help

Print Thread
#249841 19/12/14 08:11 AM
Joined: Dec 2014
Posts: 6
N
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Dec 2014
Posts: 6
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?

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
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. }
}

Last edited by Belhifet; 19/12/14 08:24 AM.
Joined: Dec 2014
Posts: 6
N
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Dec 2014
Posts: 6
thank you so much!

Joined: Nov 2014
Posts: 32
P
Ameglian cow
Offline
Ameglian cow
P
Joined: Nov 2014
Posts: 32
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!!

Last edited by Panda; 19/12/14 08:51 AM. Reason: Ooops

Link Copied to Clipboard