I made this script to play random songs or random songs by a keyword... I got confused while making it.
any help would be nice, or if theres a better way to do it would be nice.
(cant get it to play by keyword, dunno what I did wrong)

Code:
on *:text:.random*:#:{
  if (!$2) {
    timers off
    randsong1
  }
  elseif ($2) {
    timers off
    randsong2
  }
}
alias randsong1 {
  set %play.num $rand(1,$findfile(C:\My\Music\File, * ,*))
  set %song.loc $findfile(C:\My\Music\File, * ,%play.num)
  set %song $remove(%song.loc,C:\My\Music\File,.mp3)
  splay %song.loc
  msg $chan 12[14 Playing  $+ %song 12][14 $asctime($round($calc( $insong.length / 1000),0),nn:ss) 12]
  timerRAND 1 $round($calc( $insong.length / 1000),0) randsong1
}
alias randsong2 {
  set %part $2-
  set %play.num $rand(1,$findfile(C:\My\Music\File, * $+ $replace(%part,$chr(32),$chr(42)) $+ * ,*))
  set %song.loc $findfile(C:\My\Music\File, * %part * ,%play.num)
  set %song $remove(%song.loc,C:\My\Music\File,.mp3)
  splay %song.loc
  msg $chan 12[14 Playing  $+ %song 12][14 $asctime($round($calc( $insong.length / 1000),0),nn:ss) 12]
  timerRAND 1 $round($calc( $insong.length / 1000),0) randsong2
}