mIRC Homepage

How to randomize sequential responses....?

Posted By: Dan2019

How to randomize sequential responses....? - 16/05/19 02:38 PM

Hi guys ,

Below is an example of my script that triggers on channel JOIN...

on 1:JOIN:#:/timer 1 10 /msg $nick Welcome | /timer 1 20 If you like the game please vote on the main page | /timer 1 30 Thanks for visiting and enjoy your stay

I want to randomise the replies from a text file stored locally , how exactly do i do this ? I am quite new to mIRC and am just learning and have been testing used $rand but failed miserably lol. I am stumped on this one and could really use help . I'd like to have say 10 options for each sequential reply
Posted By: RoCk

Re: How to randomize sequential responses....? - 16/05/19 07:46 PM

If you use the $read identifier with no switches, it will read a random line from your file.

Replace <path\file.txt> with your own path and file name.

Code:
on 1:JOIN:#: {
 .timer 1 10 msg $nick Welcome
 .timer 1 20 msg $nick $read(<path\file.txt>)
 .timer 1 30 msg $nick Thanks for visiting and enjoy your stay
}


If you meant you want 10 responses to choose randomly for each message, you could create a file for the welcome messages, a file for the info messages and a file for the thank you messages...

Code:
on 1:JOIN:#: {
 .timer 1 10 msg $nick $read(<path\welcome.txt>)
 .timer 1 20 msg $nick $read(<path\info.txt>)
 .timer 1 30 msg $nick $read(<path\thanks.txt>)
}

Posted By: Raccoon

Re: How to randomize sequential responses....? - 17/05/19 06:11 PM

Alternatively:
Code:
  var %r = $rand(1,3)
  if (%r == 1) var %msg = Message one.
  if (%r == 2) var %msg = Message two.
  if (%r == 3) var %msg = Message three.

or
Code:
  var %msg = $gettok( $&
    Message one.@ $&
    Message two.@ $&
    Message three. $&
    , $rand(1,3) $&
    , $asc(@) $&
  )
© 2019 mIRC Discussion Forums