library SimError initializer init
//*
//*  SimError
//*
//*     Mimic an interface error message
//*       SimError(ForPlayer, msg)
//*         ForPlayer : The player to show the error
//*         msg       : The error
//*
//*     To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*

	sound error

	public function simError takes player forPlayer, string msg returns nothing
		msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00" + msg + "|r"
		if (GetLocalPlayer() == forPlayer) then
			ClearTextMessages()
			DisplayTimedTextToPlayer(forPlayer, 0.52, 0.96, 2.00, msg)
			StartSound(error)
		end
	end

	function init takes nothing returns nothing
		 error = CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)
		 //StartSound( error ) //apparently the bug in which you play a sound for the first time
									//and it doesn't work is not there anymore in patch 1.22
	end

endlibrary
