Assigning Controls: creating a Macro file for FSUIPC

This is the place where we can all meet and speak about whatever is on the mind.
Flashman
Airman First Class
Posts: 53
Joined: 27 Sep 2007
Contact:

Assigning Controls: creating a Macro file for FSUIPC

Post Flashman »

In a thread in the WOP2 section I described how to provide keyboard/button control to Accusim and other commands that cannot be assigned via normal FSX means.

http://a2asimulations.com/forum/viewtop ... 55&t=19524

Basically that thread provides a Macro file with 'new' commands in and explains how to operate them. By using this Macro file with a program called FSUIPC you can operate commands not normally available through the standard FSX interface. Put it this way, I added an extra 37 controls to the P47 accusim, and probabaly missed a few!

In that thread I promised to provide an explanation on how I produced the Macro file and I was asked today to produce a Macro file by another member for the B377, a plane I do not have. So I have decided instead to produce the explanation here of how to make a Macro file yourself! Note I have provided a Macro file for the WOP2 P40 and P51 and well as for the accusim system for the P47, though there is no reason why these cannot be improved.

First and foremost: You need a registered copy of a program called FSUIPC 4. (get googling, about 24 euros I think. Worth double the money!!). I have used version 4.53 and cannot say if this will work with earlier versions, however if you have a registered copy you can upgrade to the latest version. FSUIPC is one of the most useful utilities for FSX and allows you far more control over FSX and controls than without. I have no hesitation in recommending this program....plus you need it anyway to both create and use Macro files!!

Second. I cant garuantee this 'system' will work with other A2A aircraft that I havent tried myself, however I see no reason why it should not work. I have so far used it on aircraft produced by other Add-on makers with varying degrees of success.

Third: This does not make any changes to your aircraft of FSX programs. Everything is done within the FSUIPC program (I believe so anyway....). Simply deleting the macro file will remove the controls from your system. However you still working at your own risk etc. etc.

Fourth: I am assuming the reader has a registered copy of FSUIPC and has some experience using it.

STEP 1.

First go to your FSX files and find the 'Modules' folder and open this up. You will be doing most of the work within this folder. This folder is where FSUIPC lives and the files associated with it. In there you should find various PDF files which give explanations on how to use FSUIPC, they are thorough and very useful, in fact its basically where I learnt how to do this! I suggest you open up 'FSUIPC for advanced Users' and have a look at pages 30 & 34, also there is a PDF file about LUA plugins which is useful.

STEP 2

within the 'Modules' folder you will find a folder called 'Example LUA Plugins'. Open that folder and find an icon called 'log lvars.lua'. Simply move this up a step into the 'Modules' folder (or copy and paste if you wish). If the .lua file is in 'Modules' the FSUIPC can see and therefore use it. LUAs are basically programs that run within FSUIPC and can do all sorts of things, in this case it will read LVars (local variables) when we press keys in the cockpit. For more info in LUAs read the manual!

Next start up FSX. You will be constantly jumping in and out of FSX so I recommend you use windows mode whilst tinkering (ALT-ENTER). go to free flight and start a flight with the aircraft you wish to produce controls for, I would suggest make it dark and cold...certainly dont be flying...for now!

STEP 3.

Next, when in your plane in FSX, open up FSUIPC. The first thing we need to do is assign some controls for the LUA program we just moved. I suggest using two key presses you dont use for anything else (I use F3 and F4). Next using FSUIPC set a key for each of these two commands which you should find in the control list:

'Lua log Lvars' and 'LuaKillAll'

There are other controls associated with LUAs, however I only used these two.

Click ok in FSUIPC and return to your cockpit. Now, press the key assigned to 'Lua log Lvars' and you will see a panel with a lot of red text come up, press the key for LuaKillAll and this should disappear(sometimes you need to press both a few times for it to work). If that works you can now read LVars within the cockpit! (this is the key to this whole system and how we can operate these controls, thanks Pete Dowson!!!! (the maker of FSUIPC))

Now start the LUA and then start flicking switches in the cockpit with your mouse, you should see all sorts of things come up in red text (it may be 'rolling' anyway as things like oxygen or hydraulic pressure deplete). Dont worry about trying to read these entries within FSX, there is an easier way!

After trying some controls stop the LUA and go to your 'Modules' folder. Now you should see a file called 'log.lvars.log'

Open this file using notepad and you will see all of the entries that appeared in red on your screen in FSX within this file. Every time you start the LUA in FSX, entries are added to this file, however you need to shut it down and start it again every time you do this wioth the last entires being at the bottom. The entries in this file are Lvars, or local variables and they cover all sorts of things, though their names generally give you an idea of what they do. What use are these things? well we are going to use these entries to create a Macro file.

STEP 4.

Next we need to create a Macro file for the aircraft you are flying. Right click and start a new .txt file in notepad. Rename the file to 'whateveraircraft.MCRO' Place this file in the 'Modules' folder. For this explanation I will be using part of the Macro file I created for the P47. I called that file 1P47.MCRO. the reason I put a '1' at the start is so that it appears right at the beginning of the controls list in FSUIPC, so it is easier to find the individual controls once we start using the files itself. If you already have a macro starting with 1, use a different figure!

Next, open it in notepad and right at the top put a header of [Macros] This must have the square brackets and be called [Macros] if it is anything else it will not work and FSUIPC will not see it! Here is an example of the first few lines of my 1P47.MCRO file

[MACROS]
1=L:GunSightSwitchOn=SET
2=L:CabinVent=SET

If you where to now assign keyboard/ joystick buttons or switches to the above commands as explained in the P47 thread you could operate the controls. So where did I get the controls from? Well im sure you have guessed, I got them from the 'log lvars.log' file! However they need some work before they can be used.

Here are the corresponding entries taken from within the 'Lua log Lvars'...you need to go searching!

123672 LUA: L:GunSightSwitchOn=1
125547 LUA: L:CabinVent=0

Th part in blue is the control, you can ignore the stuff before it. The part in red is the parameter. This will change dependant upon the switch position and its function...you will be expermenting with these a lot! I simply copy the blue part and paste it into my Macro file after the 'number'=

So, to create the macro file you need to have a look through the Lvars log and find likely looking names of Lvars. Through experimentation you should be able to find you what they do and use some of them to create you macro file.

What I do is this: within the Macro file, each entry has a number followed by the '=' sign. This is shown in green in my example above, also have a look at my P47 macro file in the other thread (link at top of this thread). These need to be sequential as these identify to FSUIPC and FSX the control, though you can have missing numbers (and after much experimenting, you will do!) as you delete/ change entires. After the '1=' is the blue part of the entry from the Lvar log, i.e. from L:XXXXX=

After the'=' at the end you need to add either SET or TOG.

SET and TOG

SET or TOG (short for Toggle) tell FSUIPC how to operate this switch. With the SET command you will need to set a parameter (i.e. the red part of the Lvar log example above) for each control. I have explained fully how to do this in the P47 thread. I use SET because my home made controls use actual switches which stay on or off permanently. However if you are using either a keyboard or spring loaded joystick buttons you should probably use TOG. this simpl changes the state of the control every time you press the button or key. Basically, expermiment with these ands you will se how they operate.

Parameters

Here is where the fun starts! What ar the parameters? basically most controls which are a simple on/off switch such as the gunsight control have two states, on and off. In most cases a parameter of =0 equates to 'of' and =1 equates to 'on' as is the case with the Gunsight switch.
Some controls have 3 positions (such as the P47 starter control or landing light swicth) and these may have parameters of 0,1 and 2. SOme controls have other parameters, e.g. the cabin vent control gradually opens the cabin vent and has paramters from =0 for closed to =100 for fully open, with 1-99 for intermediate positions. The only way yo find out the parameters is to experiment. Start the log running in FSX, flick the switches then investigate the the LVar log file.

STEP 5

SO, you have created a Macro file with a few entries (I suggest just a few at first till you get the hang of it all), what next? Save the macro file and go back to FSX. Open up FSUIPC and go to the sections for assigning either a key or button press. Next is it vital that you click 'reload keypresses' or 'reload buttons' as appropriate. As im sure you can guess this reloads the buttons. This handy feature also means that you can edit the Macro file as much as you like whilst FSX is running (a godsend!), so long as you click 'reload keypresses' every time you do (after saving the macro file off course).

Next assign a key or button to the new controls. These new controls should appear in the list dependant upon the macro filename (this is where you now go and put a 1 at the front!!), howver please note: within the macro list in FSUIPC the controls appear in alphabetical order rather than the order they appear in the macro file itself. Click ok, go back into your cockpit and press you key or button.....this is the moment of truth...did the control work?!?! Well sometimes it will and sometimes it wont! This is where the experimentation comes in. After a while you get a feel for it. Try different parameters and different Lvars.

After you have tried a few, start the LUA program again and flick a few more buttons. Open up the Lvars log file in you module folder and select a few more controls and add them to your macro, save it, go back into FSX, open FSUIPC, reload the buttons and then assign keypresses to your new controls. Repeat for several hours or until you brain goes numb!

There may be times when you need to assign two or more macros to a single key or button. See the part about the Turbo Clutch control in my P47 thread for an explanation (linky at start of this thread)

The key to this is experimentation. As I dont have other aircraft (yet!) I cant say what will and wont work...just play about and see what you can do!, oh and enjoy!!! My P47 thread explains in much more detail how to assign controls to the entries within the Macro file.

Hints and Tips

1. Remember to close down and restart the 'log lvars.log' file after every time you have run the LUA within FSX
2. The Macro file must be called XXX.MCRO and the first entry must be [Macros] if not, FSUIPC wont see it!
3. Make sure the numbering is correct within the macro file. You can have missing numbers but not two controls with the saem number.
4. End each control with either =SET ot =TOG. if you use =SET you must assign a parameter...experiment!
5. Save the macro file after every change
6. Reload all buttons or keys within FSUIPC after each edit of the macro file
7. try a few controls at a time, perhaps sticking to single panels
8. This does not find normal FSX commands, or the extra FSX commands that you can normally access through FSUIPC, it only seems to find 'extras' (dont quote me on that though!)
9. Experiment! you cant break it.....at least I dont think you can!
10. The Find function is notepad is very useful......
ImageHave you been touched by his Noodly Appendage?

User avatar
guenseli
A2A Master Mechanic
Posts: 3422
Joined: 30 Jul 2008
Location: Berlin, Germany

Re: Assigning Controls: creating a Macro file for FSUIPC

Post guenseli »

Hi Flashmen,


thank you very, very much for your explanation...

I'll try it out right now and report back...
super!

User avatar
guenseli
A2A Master Mechanic
Posts: 3422
Joined: 30 Jul 2008
Location: Berlin, Germany

Re: Assigning Controls: creating a Macro file for FSUIPC

Post guenseli »

ok, I tested the first few rounds...

Its more complicated that I have hoped that it is.
Now I have a lot more resprect about your work with the P47....


The first difference here is, that I don't get a log lvars.log, but a FSUIPC4.log.
Unfortunately I can just erase that file when FSX is closed.

And I get tons and tons of data within a few seconds and I'm not able to sort out which command is the right.

Am I doing everything right or is there an easier way????

Flashman
Airman First Class
Posts: 53
Joined: 27 Sep 2007
Contact:

Re: Assigning Controls: creating a Macro file for FSUIPC

Post Flashman »

guenseli wrote:ok, I tested the first few rounds...

Its more complicated that I have hoped that it is.
Now I have a lot more resprect about your work with the P47....


The first difference here is, that I don't get a log lvars.log, but a FSUIPC4.log.
Unfortunately I can just erase that file when FSX is closed.

And I get tons and tons of data within a few seconds and I'm not able to sort out which command is the right.

Am I doing everything right or is there an easier way????
You should be getting a .txt file called log Lvars.log (i hope my explanation is correct!) when you use the LUA plugin, this should appear within your 'modules' folder. This is deifferent to the FSUIPC log file.Have a look in the various manuals just in case I missed something. Also if you are using a different version from me things might work differently. Unfortunately the log lvars.log file is essential for this to work.

Yes, there are a lot of commands! Unfortunately the only way to sort out what works is to experiment. Your macro files can have upto 1000 commands I believe so you can use as many of the entries as you like and try them all. Thats all I did for the P47, just kept trying the different commands.
ImageHave you been touched by his Noodly Appendage?

User avatar
guenseli
A2A Master Mechanic
Posts: 3422
Joined: 30 Jul 2008
Location: Berlin, Germany

Re: Assigning Controls: creating a Macro file for FSUIPC

Post guenseli »

No, I get definitely no lua log, "just the FSUIPC.log

But isn't important because I think they conatin the same.


Thanks again... with this method there are much much more possibilties. Great!



Have you managed to assign the Intercoolerflaps to Hardwarethrottles?
I don't mean the simple axis assigning with FSUIPC.
Is it possible to get a real assignment.. eg. 20% hardware throttle means 20% Intercoolerflap....?

Flashman
Airman First Class
Posts: 53
Joined: 27 Sep 2007
Contact:

Re: Assigning Controls: creating a Macro file for FSUIPC

Post Flashman »

guenseli wrote:No, I get definitely no lua log, "just the FSUIPC.log

But isn't important because I think they conatin the same.


Thanks again... with this method there are much much more possibilties. Great!



Have you managed to assign the Intercoolerflaps to Hardwarethrottles?
I don't mean the simple axis assigning with FSUIPC.
Is it possible to get a real assignment.. eg. 20% hardware throttle means 20% Intercoolerflap....?
I use a switch for the intercooler control, in fact mine looks very similar to the P47s! I have constructed my own left side console and based it in some part on the P47 cockpit and I use electric switches rather than an axis for the intercooler operation as per the accusim manual.
ImageHave you been touched by his Noodly Appendage?

Aether
Airman Basic
Posts: 8
Joined: 22 Jun 2009

Re: Assigning Controls: creating a Macro file for FSUIPC

Post Aether »

Thanks a lot for this great tutorial Flashman! :D

I had no idea how to make specific controls of the Cub and P-47 work with my home made cockpit, now I know, thanks to you. Just have to get myself to work now...
Plus, it's working on a network PC via wideclient. :lol:

I too have LUA logs in the file FSUIPC.LOG by the way.

FrankK
Senior Airman
Posts: 103
Joined: 15 Dec 2004

Re: Assigning Controls: creating a Macro file for FSUIPC

Post FrankK »

"You should be getting a .txt file called log Lvars.log (i hope my explanation is correct!) when you use the LUA plugin, this should appear within your 'modules' folder. This is deifferent to the FSUIPC log file.Have a look in the various manuals just in case I missed something. Also if you are using a different version from me things might work differently. Unfortunately the log lvars.log file is essential for this to work."

Yes I was getting only FSUIPC.log also using 4.53 version. You need to open FSUIPC then click on "Logging" and tick "LUA program logging" and you'll find the log Lvars.log file in Modules folder after you have pressed F3 toggled the required switches etc and then F4 in FSX.

Re F
Smithy

Flashman
Airman First Class
Posts: 53
Joined: 27 Sep 2007
Contact:

Re: Assigning Controls: creating a Macro file for FSUIPC

Post Flashman »

FrankK wrote:"You should be getting a .txt file called log Lvars.log (i hope my explanation is correct!) when you use the LUA plugin, this should appear within your 'modules' folder. This is deifferent to the FSUIPC log file.Have a look in the various manuals just in case I missed something. Also if you are using a different version from me things might work differently. Unfortunately the log lvars.log file is essential for this to work."

Yes I was getting only FSUIPC.log also using 4.53 version. You need to open FSUIPC then click on "Logging" and tick "LUA program logging" and you'll find the log Lvars.log file in Modules folder after you have pressed F3 toggled the required switches etc and then F4 in FSX.

Re F

Thanks for that Frankk, I was wondering why no one else was getting a log.lvars.log! I forgot about that step.

I mhope people are finding this useful.
ImageHave you been touched by his Noodly Appendage?

willemb
Airman Basic
Posts: 4
Joined: 17 Jul 2009

Re: Assigning Controls: creating a Macro file for FSUIPC

Post willemb »

Hi,
thanks for this post, because i was becoming a desperate person...
I went through the trouble of building an Mjoy16 Usb Joystick interface, primarily for use with the B377.
(it is a similar device as the BU0836 from Leo Bodnar and allows you to have 8 axes, a load of buttons and some rotary encoders for control of your flight sim). My goal was to build a throttle quadrant and add some switches to that as well.
Also i purchased FSUIPC, because i thought it was needed to create the mouse macros and tie them to my switches and such.

However to my dismay the macro recorder didn't quite work well for me, is suppose due to accusim not being read by FSUIPC.
But thanks to your explanation i might just be able to get things working after all!

It will still be a while before i get that far, but this post is a good starting point.

Too bad A2A kind of overlooked the home cockpit builder when designing Accu-Sim...
But then again, it is all such a complex matter that i really can't blame them (i know from personal experience how challenging gauge programming can be).
I am an otherwise very pleased customer and really do like the added realism of Accu-Sim.

If there is anyone out there who already has a (complete) macro for the B377, sharing that would be greatly appreciated by more home cockpit builders i think!

grtz
Willem
The Netherlands

User avatar
guenseli
A2A Master Mechanic
Posts: 3422
Joined: 30 Jul 2008
Location: Berlin, Germany

Re: Assigning Controls: creating a Macro file for FSUIPC

Post guenseli »


FrankK
Senior Airman
Posts: 103
Joined: 15 Dec 2004

Re: Assigning Controls: creating a Macro file for FSUIPC

Post FrankK »

Flashman wrote: Thanks for that Frankk, I was wondering why no one else was getting a log.lvars.log! I forgot about that step.

I mhope people are finding this useful.
Pete Dowson's stuff is awesome but it really requires translation in to more practical terms and examples as you have done. I tried the "mousetrap" procedure but it didn't work for me. Your explanation has opened the door.

FM can you explain in some detail the type of switches you are using and how these are connected to your PC?

Re
Smithy

Flashman
Airman First Class
Posts: 53
Joined: 27 Sep 2007
Contact:

Re: Assigning Controls: creating a Macro file for FSUIPC

Post Flashman »

FrankK wrote:
Flashman wrote: Thanks for that Frankk, I was wondering why no one else was getting a log.lvars.log! I forgot about that step.

I mhope people are finding this useful.
Pete Dowson's stuff is awesome but it really requires translation in to more practical terms and examples as you have done. I tried the "mousetrap" procedure but it didn't work for me. Your explanation has opened the door.

FM can you explain in some detail the type of switches you are using and how these are connected to your PC?

Re
The switches I use are simple double pole switches that can be bought from lots of places. Here is an example from Rapid where I buy mine.

http://www.rapidonline.com/Electronic-C ... ches/30255

I suggest buying the DPDT version and you can wire both sides if need be (though FSUIPC allows you to set a command when the switch is released so its not necessary for FSX, however is useful for other flight sims). I also have a few on-off-on with a centre off position. I use this for instance for the starter on the P47 or the oil/ intercooler switches.

To connect my switches to the computer i use a device called a BU0836X controller. you can wire up to 36 switches and 8 axes to it and it just connect to your computer via USB. You computer simply sees it as a joystick and you can assign the controls as required via FSUIPC.

http://www.leobodnar.com/products/BU0836X/

Cant recommend it enough!
ImageHave you been touched by his Noodly Appendage?

willemb
Airman Basic
Posts: 4
Joined: 17 Jul 2009

Re: Assigning Controls: creating a Macro file for FSUIPC

Post willemb »

guenseli wrote:Hey Willem,

look here:

http://www.a2asimulations.com/forum/vie ... 37&t=19851

have fun!

Many thanks man!!


grt
Willem

FrankK
Senior Airman
Posts: 103
Joined: 15 Dec 2004

Re: Assigning Controls: creating a Macro file for FSUIPC

Post FrankK »

Flashman wrote:
FrankK wrote:
Flashman wrote: Thanks for that Frankk, I was wondering why no one else was getting a log.lvars.log! I forgot about that step.

I mhope people are finding this useful.
Pete Dowson's stuff is awesome but it really requires translation in to more practical terms and examples as you have done. I tried the "mousetrap" procedure but it didn't work for me. Your explanation has opened the door.

FM can you explain in some detail the type of switches you are using and how these are connected to your PC?

Re
The switches I use are simple double pole switches that can be bought from lots of places. Here is an example from Rapid where I buy mine.

http://www.rapidonline.com/Electronic-C ... ches/30255

I suggest buying the DPDT version and you can wire both sides if need be (though FSUIPC allows you to set a command when the switch is released so its not necessary for FSX, however is useful for other flight sims). I also have a few on-off-on with a centre off position. I use this for instance for the starter on the P47 or the oil/ intercooler switches.

To connect my switches to the computer i use a device called a BU0836X controller. you can wire up to 36 switches and 8 axes to it and it just connect to your computer via USB. You computer simply sees it as a joystick and you can assign the controls as required via FSUIPC.

http://www.leobodnar.com/products/BU0836X/

Cant recommend it enough!
I take it the BU0836 (not the X version) would be more suitable for a linear potentiometer set up say for the B17 turbo control? Its not clear what the exact differences are between the two circuit boards.

Re
Smithy

new reply

Return to “Pilot's Lounge”

Who is online

Users browsing this forum: No registered users and 3 guests