-- This Lua script can be used to pause chatter based on
-- the radio power state of various aircraft.



	--  JF_PA28_Turbo_Arrow


if PLANE_ICAO == "P28U" then


dataref("CHA", "sim/cockpit2/radios/actuators/gps_power", "writeable")

		
	function chatter()
		if (CHA == 0) then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
		end
	end

	do_often("chatter()")
	end
	
	
	--  JF_PA28_Arrow
	
if PLANE_ICAO == "P28R" then


dataref("CHA", "sim/cockpit2/radios/actuators/gps_power", "writeable")

		
	function chatter()
		if (CHA == 0) then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
		end
	end

	do_often("chatter()")
	end


	--  Alabeo C177_Cardinal


if PLANE_ICAO == "C177" then


dataref("CHA", "sim/cockpit2/radios/actuators/gps_power", "writeable")

		
	function chatter()
		if (CHA == 0) then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
		end
	end

	do_often("chatter()")
	end	
	
	
	
	--  Carenado PA31 - Navajo 
	
	if PLANE_ICAO == "PA31N" then


dataref("CHA", "sim/cockpit2/radios/actuators/gps_power", "writeable")

		
	function chatter()
		if (CHA == 0) then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
		end
	end

	do_often("chatter()")
	end	
	
	
	
	--  Carenado Carenado PC12_v1.3
	
if PLANE_ICAO == "PC12" then	

dataref("CHA", "thranda/electrical/GNS1Pwr", "writeable")

		
	function chatter()
		if (CHA == 0) then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
		end
	end

	 do_often("chatter()")
	end
	
	
	
	
	--  EMB110
	
	
	if PLANE_ICAO == "E110" then	

dataref("CHA", "EMB110/switch/gps_530_on_off", "writeable")

		
	function chatter()
		if (CHA == 0) then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
		end
	end

	do_often("chatter()")
	end
	
	
	
	
	--  Digital Replica Cessna 310L
	
	
	if PLANE_ICAO == "C310" then	

dataref("CHA", "sim/cockpit2/radios/actuators/com1_power", "writeable")

		
	function chatter()
		if (CHA == 0) then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
		end
	end

	do_often("chatter()")
	end
	
	
	
	--  IXEG 737 Classic
		
	if PLANE_ICAO == "B733" then


dataref("CHA", "ixeg/733/electrical/stdby_power_off_ann", "writeable")
dataref("CM1", "ixeg/733/audio/ann_audio_rec_vhf1_pt", "writeable")
dataref("CM2", "ixeg/733/audio/ann_audio_rec_vhf1_cpt", "writeable")


	function chatter()
		
		CM3 = CM1 + CM2
	
		if (CHA > .99)  then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
		
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
			
			
			if (CM3 == 0) then
		
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
			
			end 
						
			
			
		end
		
	end

	do_often("chatter()")
	end
	
	
	
	--  ISSGE-195_Evolution
	
	if PLANE_ICAO == "E195" then


dataref("CHA", "SSG/EJET/SYS/system2_off", "writeable")
dataref("CM1", "sim/cockpit2/radios/actuators/audio_selection_com1", "writeable")

	function chatter()
		
	if (CHA == 0)  then
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else
		
			set ( "SRS/X-ATC-Chatter/external_pause", 0)
			
		if (CM1 == 0) then
		
			set ( "SRS/X-ATC-Chatter/external_pause", 1)
			
		end 	
			
			
			
		end
		
		
	end

	do_often("chatter()")
	end
	
	
	--  ToLiss - A319/321
	
	if PLANE_ICAO == "A319" then


dataref("ACM", "sim/cockpit2/radios/actuators/audio_selection_com1")
dataref("CM1", "ckpt/oh/1/radioSwitch/anim", "writeable")


	function chatter()
		
		if (CM1 == 0)  then
				set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else	
	
				set ( "SRS/X-ATC-Chatter/external_pause", 0)
		

			if (ACM == 0)  then

					set ( "SRS/X-ATC-Chatter/external_pause", 1)
			
			end 
			
		end
		
	end
	

	do_often("chatter()")

	end
	
	
if PLANE_ICAO == "A321" then


dataref("ACM", "sim/cockpit2/radios/actuators/audio_selection_com1")
dataref("CM1", "ckpt/oh/1/radioSwitch/anim", "writeable")


	function chatter()
		
		if (CM1 == 0)  then
				set ( "SRS/X-ATC-Chatter/external_pause", 1)
		else	
	
				set ( "SRS/X-ATC-Chatter/external_pause", 0)
		

			if (ACM == 0)  then

					set ( "SRS/X-ATC-Chatter/external_pause", 1)
			
			end 
			
		end
		
	end
	

	do_often("chatter()")

	end		
	
	
	
	
	
	
	
