Keith's LUA Help thread.

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
Mike Horsten
Posts: 79
Joined: Tue Dec 01, 2020 8:50 am

Re: Keith's LUA Help thread.

#271 Post by Mike Horsten »

Thanks Keith
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: MULTIPLE assignments to one pin

#272 Post by jph »

Mike Horsten wrote: Fri Apr 23, 2021 1:00 pm Hi Guru's.

Noob question, example question. I have a plane with 4 engines, 4 prop controls, 4 minxure controls. Can i assign engine 1/2/3/4 to one linear hardware pod and control alle engines with one. Same would go for the Mixture and Prop control. reason for asking, if i would like to fly a DC6 for example my current setup is a C172. The instruments i can change but the hardware is a bit more tricky.

Code wise it would be same as the tutorial. That has an error in it.
- For X-Plane we need to override the joystick input first NONONONONO this disables all Joystick input like the ruddel pedals, saitek yoke and all others !!!!!
xpl_dataref_write("sim/operation/override/override_joystick", "INT", 1) -- DONT USE this part of the example
[/b]



Mike
Hi Mike,
In the joystick setup of X-Plane simply assign the 'throttle' on your controller to 'throttle' in X-Plane and this will control all - same for props / mixture etc . this is on the top of the screen in X=Plane when you select the axis.
unless you are trying to do this in AM ???? - which I would certainly not recommend. IMHO, for all normal axis inputs then use the normal HID game controller / joystick . If you want to make your own with an Arduino then it is no problem with the Leonardo Or Pro Micro. Completely independent of AM/// Apologies if I am misunderstanding your intent .
X=Plane does this natively if you require it.
Joe
Joe. CISSP, MSc.

Mike Horsten
Posts: 79
Joined: Tue Dec 01, 2020 8:50 am

Re: MULTIPLE assignments to one pin

#273 Post by Mike Horsten »

Joe,

When i started building the TMP for the C172 i used this command as its in the WIKI. and designed the 3 units with liniar pods (TMP). Al worked on well the workbench/test setup and then i installed it in the rig. As i integrated some external parts i noticed a problem . My rudders and yoke where not working any more. With the command in place all my other inputs from joysticks (CHPro/Saitek) stopped working , because i told XP to do so because of the command. It took me some time to understand that this was the issue. Its a general disablement command not only for the things i was doing. That's why i mention it, as its in the wiki.. remove it you can always add a special command later.

Mike
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: MULTIPLE assignments to one pin

#274 Post by jph »

Mike Horsten wrote: Sun Apr 25, 2021 6:51 am Joe,

When i started building the TMP for the C172 i used this command as its in the WIKI. and designed the 3 units with liniar pods (TMP). Al worked on well the workbench/test setup and then i installed it in the rig. As i integrated some external parts i noticed a problem . My rudders and yoke where not working any more. With the command in place all my other inputs from joysticks (CHPro/Saitek) stopped working , because i told XP to do so because of the command. It took me some time to understand that this was the issue. Its a general disablement command not only for the things i was doing. That's why i mention it, as its in the wiki.. remove it you can always add a special command later.

Mike
Hi Mike, If I understand you correctly, then I would seriously suggest that you 'roll your own' Game Controller / Joystick using a Leonardo or Pro Micro arduino. It is nothing at all to do with AM, it simply adds a game controller to the windows control panel. You can then do whatever you want. I am sure there are some uses for this in AM, but as of yet, I fail to see them. The game controller via Arduino joystick library is HID - DIRECT to windows and a higher priority than AM.
I think AM is bloody amazing - but as far as game controllers / Joysticks ???? ... standard USB HID 100% of the time.
Joe
Joe. CISSP, MSc.

Mike Horsten
Posts: 79
Joined: Tue Dec 01, 2020 8:50 am

Re: Keith's LUA Help thread.

#275 Post by Mike Horsten »

No you missunderstood, but dont worry....it works
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Keith's LUA Help thread.

#276 Post by jph »

Mike Horsten wrote: Sun Apr 25, 2021 11:22 am No you missunderstood, but dont worry....it works
:D Glad I did Mike.
Excellent. The end result is all that matters,
Joe ;)
Joe. CISSP, MSc.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#277 Post by Keith Baxter »

@Corjan

This encoder should not work. Is something broke or does visibility not work on hardware nodes?

Code: Select all

function dial_change(dir)
  print("Dial is visible")
end


my_encoder=hw_dial_add("Menu Scroll", dial_change)

visible(my_encoder,false)
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Keith's LUA Help thread.

#278 Post by Ralph »

There is no visibility on hardware as I know. You can't make an encoder invisible unless you're Harry Potter :)

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#279 Post by Keith Baxter »

Ralph wrote: Fri Dec 03, 2021 6:13 am There is no visibility on hardware as I know. You can't make an encoder invisible unless you're Harry Potter :)
LOL Ralph :lol:

What I wanted to do was disable the encoder when the instrument is at a specific state.

So by saying "visible(my_encoder,my_state==1)" the encoder stops working if my_state is ~= 1
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#280 Post by Keith Baxter »

@Ralph @Corjan

Suggestion. If HW nodes do not work with visible() and group_add(). Perhaps an error report in AM console!!!


Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply