TinTin++ Mud Client Scripts  
space
space
For this script to work the MUD needs to support MSP (Mud Sound Protocol), you must have the right audio files in the /~sounds directory (directory can be changed in the script), and you must have the right packages installed to play sound files.

This script is written for v2.01.97 and higher

space
#EVENT {PROGRAM START}
{
	#nop Find out what OS you are running.;
	#script {SYSTEM[OS]} {uname -o};
	#script {SYSTEM[KERNEL]} {uname -s};
	#switch {"$SYSTEM[OS][1]"}
	{
		#case {"Android"}
		{
			#variable OS Android
		};
		#case {"Cygwin"}
		{
			#variable OS Cygwin
		};
		#case {"GNU/Linux"}
		{
			#variable OS Linux
		};
		#default
		{
			#switch {"$SYSTEM[KERNEL][1]"}
			{
				#case {"Linux"}
				{
					#variable OS Linux
				};
				#case {"CYGWIN%*"}
				{
					#variable OS Cygwin
				};
				#case {"Darwin"}
				{
					#variable OS Darwin
				};
				#default
				{
					#variable OS Unknown
				}
			}
		}
	}
}


#EVENT {IAC WILL MSP}
{
	#send {\xFF\xFD\x5A\};
	#unevent {IAC WILL MSP}
}


#ACTION {^!!SOUND({\S*}{.*})$}
{
	playsound %1;
	#line gag
}
{5}


#ACTION {^!!MUSIC({\S*}{.*})$}
{
	#nop I cannot be bothered adding support for background music.;
	#line gag
}
{5}


#VARIABLE {sound_dir} {~/sounds}

#ALIAS {playsound %1}
{
	#if {"%1" == "Off"}
	{
		#return
	};
	#switch {"$OS"}
	{
		#case {"{Android|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 &
		}
	}
}
{5}


#ALIAS {tts}
{
	#switch {"$OS"}
	{
		#case {"Android"}
		{
			#system {termux-tts-speak %0 &}
		};
		#case {"{Cygwin|Linux}"}
		{
			#system {espeak "%0" &}
		};
		#case {"Darwin"}
		{
			#system {say %0 &}
		}
	}
}
{5}