mIRC Home    About    Download    Register    News    Help

Topic Options
#265500 - 16/05/19 03:38 PM How to randomize sequential responses....?
Dan2019 Offline
Self-satisified door

Registered: 14/05/19
Posts: 3
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

Top
#265501 - 16/05/19 08:46 PM Re: How to randomize sequential responses....? [Re: Dan2019]
RoCk Offline
Hoopy frood

Registered: 16/12/02
Posts: 2010
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>)
}


Top
#265504 - 17/05/19 07:11 PM Re: How to randomize sequential responses....? [Re: RoCk]
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2597
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(@) $&
  )
_________________________
Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Top