Jump to content
The simFlight Network Forums

Macro alternative


Recommended Posts

Moved to Main Forum. Please ask questions related to FSUIPC always in Main Forum.

Hello - I have the latest FSUIPC release (5.124) is this capable of macros at all?  I know the earlier release isn't but I'm not clear about the latest version.  And if not, I need a way to turn on the IRS switches in PMDG-NGX 737 (P3Dv4.2) - either by a push button or a physical switch ... any suggestions?

Many thanks

Father Dane

Link to comment
Share on other sites

2 hours ago, FatherDane said:

I have the latest FSUIPC release (5.124) is this capable of macros at all?

By way of clarification, and to add to Thomas's reply, yes, ALL versions of FSUIPC support "Macro" files (with filetype .mcro), and have for a long time. What isn't currently supported in FSUIPC5 are "mouse macros" which are types of macros created to simulate mouse clicking on switches or buttons.

Generally, "mouse macros" rather "went out of fashion" for all but a very few aircraft. Most recent aircraft use XML and local variables (L:Vars), or have their own control system. Even the others often are not written in a way allowing moue macros to operate (they depend on a particular method of implementation, originating with the Gauges SDK in FS2004 or before). 

Thomas referred to the better way with the 737NGX. The PMDG 737, 747 and 777 all support a complete set of "custom controls" assignable in FSUIPC. As Thomas said, you need to see the list in the PMDG SDK (a sub-folder in your PMDG 737 folder) -- the .h type file lists them, towards the end. You have to calculate the control number (just adding two other numbers) then assign in FSUIPC using the <custom control> selection.

L:Vars can be written, again using Macros, but you need to construct those macro files yourself. PMDG don't use them to my knowledge.

Mouse macro implementation in FSUIPC5 is planned, using new facilities provided by L-M in its "PDK".  As yet there's no timescale I'm afraid. As I said, they have less application now.  When they are implemented they will deal with ALL aircraft panels, but sadly, at present, it seems only if the panel is visible on screen which might rather spoil the point for those trying to implement a hardware cockpit instead of using the screen one.

Pete

 

Link to comment
Share on other sites

Hi Father Dane,

The following LUA code will do what you require.

Just copy and paste it into Notepad and save the file with a .lua extension. eg: 'PMDG_737_NGX_IRS.lua'

The file needs to be placed in you Modules folder for FSUIPC to see it.

 

You will then be able to assign this lUA script to a switch, or as many switches as you like, in the usual way.

It will be listed as 'Lua PMDG 737 NGX IRS'

You need to set the Parameter option to select what you wish it to do.

Parameter of 10 will set the Left IRS to OFF

Parameter of 12 will set the Left IRS to NAV

The script doesn't care where the IRS switch is currently at, it just moves it from there to the required position.

Other Parameters are listed at the top of the lua script. Any invalid Parameter will just be ignored.

 

I have only tested this in FSX as I do not have the NGX for P3d,  though I see no reason why it would not work in P3D.

 

Hope this helps.

 

Chris.

 

--	Parameters to send via FSUIPC

--	10	-	Left IRS OFF
--	11	-	Left IRS ALIGN
--	12	-	Left IRS NAV
--	13	-	Left IRS ATT
--	20	-	Right IRS OFF
--	21	-	Right IRS ALIGN
--	22	-	Right IRS NAV
--	23	-	Right IRS ATT

PMDGBaseVar = 	0x00011000		-- 69632
PMDG_ClkL = 	0x20000000		-- 536870912
PMDG_ClkR = 	0x80000000		-- -2147483648

function Left_IRS(New_Pos)
	local Current_Pos = ipc.readLvar ('ngx_switch_255_a') /10
	while New_Pos > Current_Pos do
		ipc.control(PMDGBaseVar + 255, PMDG_ClkR)
		Current_Pos = Current_Pos + 1
	end
	while New_Pos < Current_Pos do
		ipc.control(PMDGBaseVar + 255, PMDG_ClkL)
		Current_Pos = Current_Pos - 1
	end
end

function Right_IRS(New_Pos)
	local Current_Pos = ipc.readLvar ('ngx_switch_256_a') /10
	while New_Pos > Current_Pos do
		ipc.control(PMDGBaseVar + 256, PMDG_ClkR)
		Current_Pos = Current_Pos + 1
	end
	while New_Pos < Current_Pos do
		ipc.control(PMDGBaseVar + 256, PMDG_ClkL)
		Current_Pos = Current_Pos - 1
	end
end

MyPosition = ipcPARAM - 10
IRS = 1

if MyPosition > 9 then
	MyPosition = MyPosition - 10
	IRS = 2
end

if MyPosition >= 0 and MyPosition < 4 then
	if IRS == 1 then
		Left_IRS (MyPosition)
	elseif IRS == 2 then
		Right_IRS (MyPosition)
	end
end

 

Link to comment
Share on other sites

Just further on the original question, about mouse macros, I am pleased to say that the new P3D4 facilities to trap and reproduce mouse clicks on gauges work very well, and reproducing them when the panel isn't even present on screen also works well.

So, I am implementing mouse macros now, ready for the next release.

Oh, also, better than FSUIPC4 and before, mouse macros should work with all switches and buttons on ALL aircraft!

Pete

 

Link to comment
Share on other sites

Greetings

This is good news indeed - as a neophyte with programming I approach it with dread and panic!  But I will be trying out the code ccb777 above recommended today to see if I can get it to work.  Otherwise I shall be waiting with great anticipation for the next FSUIPC release.

Thank you for being so patient with an old man.

Father Dane

Link to comment
Share on other sites

Greetings from South Yorkshire

I just tried the code submitted by ccb777  above and was successful in getting the left and right IRS to work perfectly.  Chris is a bloody genius! Thank you - and thanks to all of you who have helped me with this project.

Father Dane

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.