mIRC Homepage
Posted By: BIGZIPZ $read and specific lines - 01/07/08 05:19 PM
Code:
alias /pay_high {
  set %NumberOfLines $lines("C:\Program Files\mIRC_ComicQuiz\HiLo_HighBet.txt")
  var %j = 1
  while (%j <= %NumberOfLines) {
    msg #BIGZIPZ Winner: $read("C:\Program Files\mIRC_ComicQuiz\HiLo_HighBet.txt"),%j)
    inc %j
  }
}


The preceding code is from a simple Higher or Lower game I made, and is part of the code which triggers when the outcome is Higher. As I understand it $read(filename,1) would read line 1, etc etc. Yet with my code it reads a random line even though I specify %j which is a number.

$read("C:\Program Files\mIRC_ComicQuiz\HiLo_HighBet.txt"),%j)

Am I using the syntax incorrectly? Thanks alot
Posted By: RusselB Re: $read and specific lines - 01/07/08 05:38 PM
remove the ) between the file name and the , separating the %j parameter.

Btw: looking at your code, a better way to do this is to use mIRC's /play command, as the way you're doing it will probably flood you off of the network, as the /play command has a built in delay

Also you don't need the / in the alias name.

Code:
alias pay_high {
  .msg #BIGZIPZ Winners:
  .play "C:\Program Files\mIRC_ComicQuiz\HiLo_HighBet.txt"
}

If you really want the word Winner in front of each line, then I suggest you change the msg line in your code to read
Code:
.timer 1 %j msg #BIGZIPZ Winner: $read("C:\Program Files\mIRC_ComicQuiz\HiLo_HighBet.txt",%j)
Posted By: BIGZIPZ Re: $read and specific lines - 01/07/08 06:43 PM
Thank you very much for your help it has helped alot.
© mIRC Discussion Forums