'##############
'Matrix Script
'##############

'Simulates 80s style Matrix Line and Terminus Display (Type Annax)

'(c) 13.04.2010 Marcel Kuhnt

'Script Version: 1.1
'Omsi release: 1.0

'Needs:
'- Cockpit (Batterietrennschalter)


'Revision History:
'- Marcel Kuhnt		10.08.2009	Added Revision History
'- Marcel Kuhnt		13.04.2010	Added Line List Script
'- Marcel Kuhnt		23.04.2010	Line right formatted
'- Sartorius		14.12.2013	Plywood

'------------------------------------------------------------------------------------------

{trigger:cp_tabl_toggle}
	(L.L.cp_tabl2_visible) (S.L.cp_tabl1_visible) ! (S.L.cp_tabl2_visible)
	{if}
		(M.L.Matrix_Update)
	{else}
		0 (S.L.target_index_int)
	{endif}
{end}

{macro:Matrix_init}
	"                @                @                " (S.$.Matrix_Terminus)
	"   " (S.$.Matrix_Nr)

	1 (S.L.cp_tabl1_visible) ! (S.L.cp_tabl2_visible)
{end}


{trigger:ai_scheduled_settarget}
	(L.L.AI_target_index) (S.L.Matrix_TerminusIndex)
	(M.L.Matrix_Update)
	1 (S.L.cp_tabl2_visible) ! (S.L.cp_tabl1_visible)

'Stromversorgung herstellen:
	1 (S.L.elec_busbar_main_sw)	
	1.0 (S.L.elec_V_battery)
{end}


{macro:Matrix_frame}
	(L.L.AI) (M.V.GetTTTerminusIndex) (L.L.Matrix_TerminusIndex) = ! &&
	{if}
		(M.L.Matrix_Update)
	{endif}
{end}

{macro:Matrix_Update}
	(M.V.GetTTTerminusIndex) (S.L.Matrix_TerminusIndex) (S.L.target_index_int)

'******************************+
'    Terminus-Matrix
'******************************+
	(L.L.Matrix_TerminusIndex) 1 (M.V.GetTerminusString) 16 $SetLengthL "@" $+
	(L.L.Matrix_TerminusIndex) 2 (M.V.GetTerminusString) 16 $SetLengthL "@" $+ $+
	(L.L.Matrix_TerminusIndex) 3 (M.V.GetTerminusString) 16 $SetLengthL $+
	(S.$.Matrix_Terminus)

'******************************+
'    Nr-Matrix
'******************************+
	(M.V.GetTTLineString) 3 $SetLengthR (S.$.Matrix_Nr)

	1 (S.L.Refresh_Strings)
{end}