I am trying to make a script that will choose a random line from a random log in my log folder, as long as a) it's a channel log and not a PM, and b) the channel name starts with 'd'. Here is what I have so far. It works, but I'd like to add some more parameters to it, and I've hit a wall trying to figure it out. So here goes.

Code:
alias logline {
  // get number of files in logdir (in this case, only logs where the channel name starts with '#d'
  var %i = $findfile($logdir,#d*,0)

  // get a random file
  var %z = $findfile($logdir,#d*,$rand(1,%i))

  // get random line from chosen file, finding a line where someone has spoken (ex. "<person> blah")
  var %x = $read(%z, w, *<*>*)

  // set %s as the first token in the string, in this case the timestamp
  var %s = $gettok(%x,1,32)

  // remove the timestamp singled out above, and output
  return $remove(%x,%s)
}


I know this is by no means the most optimal way to accomplish this, but it's what I've got so far. Anyways, what I'd like to do is make it so that it will start over and select another line if the line it initially chooses starts with a * (for weeding out joins/parts/topics).

Any help is appreciated, thanks

Last edited by synth7; 20/02/08 05:15 AM.