Can LUA code make this switch work?
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
Joe,
Maybe you can help me "debug" this.
Since I really dont know exactly what the code is doing, I usually have to just cut and paste from examples and stumble around in the dark.
I found this battery switch example which uses a (2) way. I am not sure if my switch is a (2) way with ON and OFF or is it a (1) way just ON and nothing?
This example does not show any (1) way switch coding. All it says is to change the 2 to a 1 in the bottom hw_switch_add line.
I took this example and changed the names / IDs ? and replaced the Xplane commands with the datarefs for this particular switch.
If I knew what I was doing, or what all of this is doing I would be able to figure out the problem.
So what am I doing wrong here? Is this a good switch example to start with?
I dont understand what that error message means.
Maybe you can help me "debug" this.
Since I really dont know exactly what the code is doing, I usually have to just cut and paste from examples and stumble around in the dark.
I found this battery switch example which uses a (2) way. I am not sure if my switch is a (2) way with ON and OFF or is it a (1) way just ON and nothing?
This example does not show any (1) way switch coding. All it says is to change the 2 to a 1 in the bottom hw_switch_add line.
I took this example and changed the names / IDs ? and replaced the Xplane commands with the datarefs for this particular switch.
If I knew what I was doing, or what all of this is doing I would be able to figure out the problem.
So what am I doing wrong here? Is this a good switch example to start with?
I dont understand what that error message means.
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
After closing out of AM and starting up, I still have the overlap of one switch to the other.
However, now I dont get the same error but the hardware slider is now gone.
However, now I dont get the same error but the hardware slider is now gone.
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
I thought I found the problem but nope....
Time for some single malt scotch....a double.....
Time for some single malt scotch....a double.....
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
I am closer now, and fixed all of that stuff above, but dont know how I did it
Still having an overlap issue.
If I go to the new DME power switch code window, and hit run...it works.
But the 3 way switch does not work.
Then when I go to the code window for the 3 way switch and hit run it starts working but the 2 way switch stops and it's console shows the print position lines for the 3way switch.
I can't figure out how these two switches are interlinked....
Still having an overlap issue.
If I go to the new DME power switch code window, and hit run...it works.
But the 3 way switch does not work.
Then when I go to the code window for the 3 way switch and hit run it starts working but the 2 way switch stops and it's console shows the print position lines for the 3way switch.
I can't figure out how these two switches are interlinked....
Last edited by Kaellis991 on Fri Sep 16, 2022 7:27 pm, edited 1 time in total.
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Can LUA code make this switch work?
Hi,Kaellis991 wrote: ↑Fri Sep 16, 2022 6:02 pm After closing out of AM and starting up, I still have the overlap of one switch to the other.
However, now I dont get the same error but the hardware slider is now gone.
image.png
You are not running the instrument.
ALL hardware switches need to be in the same instrument if run via create/edit.
Different if within a panel.
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
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
Hey Keith,
Thanks for chiming in.
I have a panel, a PA28 hidden panel that has all of my hardware functions and (1) instrument.
Are you saying that my two new hardware functions switches need to be placed in my PA28 panel along with all the others then they can work concurrently?
Thanks for chiming in.
I have a panel, a PA28 hidden panel that has all of my hardware functions and (1) instrument.
Are you saying that my two new hardware functions switches need to be placed in my PA28 panel along with all the others then they can work concurrently?
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
Keith,
I did that. Seems to work now....one step I was missing.
Thanks
Kirk
I did that. Seems to work now....one step I was missing.
Thanks
Kirk
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
Since I am not using any instruments that will display on a monitor, the hardware must be in the panel.Keith Baxter wrote: ↑Fri Sep 16, 2022 7:17 pmHi,Kaellis991 wrote: ↑Fri Sep 16, 2022 6:02 pm After closing out of AM and starting up, I still have the overlap of one switch to the other.
However, now I dont get the same error but the hardware slider is now gone.
image.png
You are not running the instrument.
ALL hardware switches need to be in the same instrument if run via create/edit.
Different if within a panel.
Keith
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Can LUA code make this switch work?
The DME power switch was my first successful script, but of course had to base it on the battery switch example.
Baby steps.....
Thanks for your help.
Last piece of this complex puzzle of all white pieces is my much more complicated autopilot.
Baby steps.....
Thanks for your help.
Last piece of this complex puzzle of all white pieces is my much more complicated autopilot.
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Can LUA code make this switch work?
Hi,Kaellis991 wrote: ↑Fri Sep 16, 2022 7:46 pm The DME power switch was my first successful script, but of course had to base it on the battery switch example.
Baby steps.....
Thanks for your help.
Last piece of this complex puzzle of all white pieces is my much more complicated autopilot.
I tend to create "INSTRUMENTS" in sections.
Always remember that for them to work in cohesive, They need to be included within a panel.
When creating "instruments" construct them in "SET". Do not create many individual switch instruments when a switch panel instrument with all your switches would do the trick.
What most have been teaching you is the basic operation of lua functions. You now need to take that to the next level, Incorporating those learning's into a multi functional instrument.
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