I got bored and figured I would do this also. Here is a shorter version of your script
on *:text:.*:#:{
if ($1 == .sart) {
play stop
return
}
if ($1 == .rart) {
play $chan $+(",$findfile(mircart, *.txt, $rand(1, $findfile(mircart, *.txt, 0))),") 500
return
}
else {
play $chan mircart/ $+ $deltok( $+ $1 $+ ,0,46) $+ .txt 500
}
}