#nop This script is written for v1.99.8 and higher
#nop Find out what OS you're running.
#script {OS} {uname -s}
#switch {"$OS[1]"}
{
#case {"Linux"}
{
#var OS Linux
};
#case {"CYGWIN%*"}
{
#var OS Cygwin
};
#case {"Darwin"}
{
#var OS Darwin
};
#default
{
#var OS Unknown
}
}
#nop Do the TELNET negotiation thing.
#event {IAC WILL MSP}
{
#send {\xFF\xFD\x5A\};
#unevent {IAC WILL MSP}
}
#act {^!!SOUND({\S*}{.*})$}
{
playsound %1;
#line gag
}
#nop I can't be bothered adding support for background music.
#act {^!!MUSIC({\S*}{.*})$}
{
#line gag
}
#var sound_dir ~/sounds
#alias {playsound %1}
{
#if {"%1" == "Off"}
{
#return;
};
#switch {"$OS"}
{
#case {"Linux"}
{
#if {"%1" == "%i%*.mp3"}
{
#system mpg123 $sound_dir/%1 &>/dev/null &
};
#elseif {"%1" == "%i%*.ogg"}
{
#system ogg123 $sound_dir/%1 &>/dev/null &
};
#elseif {"%1" == "%i%*.wav"}
{
#system play $sound_dir/%1 &>/dev/null &
};
#else
{
#showme PLAYSOUND: Unknown sound file: %1
}
};
#case {"Cygwin"}
{
#if {"%1" == "%i%*.wav"}
{
#system cat $sound_dir/%1 > /dev/dsp &
};
#else
{
#system cygstart $sound_dir/%1 &
}
};
#case {"Darwin"}
{
#system afplay $sound_dir/%1 &
}
}
}
|