Archived

This topic is now archived and is closed to further replies.

Mickeyj

Who tells a switch how it operates

Recommended Posts

Hello folks,

 

i just fell over LINDA and LUA. Im into chopper flying on FSX/P3D and found out i can operate switches via HOTAS and LINDA ;) For ex i have the module for the ND Skycrane and now i can operate the snorkle, yeah :D

 

Im using the TM Warthog HOTAS.

 

Now i wanted to program a module for Ceras UH60. My first switch i wanted to operate was the Force Trim Release on the stick. I found the Lvar trimrel. It toggles when i use the Tracer. I was able to program the switch sound but unfortunately the switch itself is not operating.

 

I progamed the button via a toggle on/off. It is a standard push button. 

 

I already checked the Skycrane module for hints and i tried some codes but nothing was working despite the klick sound :(

 

So which command tells the button that it is a push button?

 

Many thanks.

 

YOu guys did a great job on LINDA!!!

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

 

 


So which command tells the button that it is a push button?

 

Hello,

 

there isn't a standard "do that and it works". Eveything is about investigating and trying.

Every addon behaves completely different, even from the same developer.

 

One have very clearly named LUA variables, like "L:Landing_Linght", others use just cryptic numbers, like "L:88765", others use FSUIPC controls and/or offsets. Some use the standard FSX controls, but the switch sounds are toggled with an extra variable.

 

All you can do is: use the tracer and try what happens ...

 

Sorry to give not a more specific help here

Share this post


Link to post
Share on other sites

Very likely there is a separate LVar for the switch animation.

Share this post


Link to post
Share on other sites

Many thanks for your replies. I will go ahead and try further options. I mean i was happy to hear the sound so there might be a way to see the animation or the action of the button. Within the sim the button is operated by the mouse. I can see the hand and the action.

 

Anyway i wil post the two line packages i programmend so you guys could have a llok at it or maybe test it if you have the cera UH60 

Share this post


Link to post
Share on other sites

Hello,

 

i got managed to control the landing lights and the search lights :) Just had to do some copy and paste stuff and checking the Lvars.

Share this post


Link to post
Share on other sites

Ok guys,

 

major success wrote my first ever Linda/Lua module :)) I finally got that force trim switch to actuate the animation is visible but the the function is missing. Nevermind the module for the H-60 has a bit more than just a non functional switch. I can open the doors and switching on/off lots of lights. ver. 1 would be ready for upload but how. Any suggestions?

 

 

Merry x mas to ya

Share this post


Link to post
Share on other sites

Oh i have another question about negativ values. In the Cera Bell212/412 is the engine start switch which is operated to the left for left engine start and to right for the right one. Now i got it to program the left engine start cycle like ipc.writeLvar("L:starteng" , 1) now the tracer tells me that for the right engine start cycle the value would be -1 to flip the switch to the right. The editor tells me that the syntax ipc.writeLvar("L:starteng" , -1) is correct but the switch does not move to the right.

 

Is there a different way to program such switch behaviour. As i said in tracer entering 0 toggle -1 operates the switch to the right.

 

Thanks MJ 

Share this post


Link to post
Share on other sites

Hello,

 

great you're doing a module

 

AS I understand it:

 

one switch is

Lvar -1 "on"

Lvar 0 "off"

 

the other switch

Lvar 0 "off"

Lvar 1 "on"

 

isn't that working?

Share this post


Link to post
Share on other sites

Hallo Guenther,

 

actually it is one switch with 3 functions Lvar=1 (engine 1 start) Lvar=0 (starter off) Lvar=-1(engine 2 start)

Share this post


Link to post
Share on other sites

Hello again,

 

i will try another attemp to program that switch. I think i know the problem. As the switch knows 3 functions 1 0 -1 do i have to sett the order of the switch position?

Share this post


Link to post
Share on other sites

Hallo Guenter,

 

these are the lua lines i added

 

--- ## Engines ##########
 
function Engine_One_Start_On ()
    ipc.writeLvar("L:starteng", 1)
end
 
function Engine_One_Start_Off ()
    ipc.writeLvar("L:starteng", 0)
end
 
function Engine_One_Start_Toggle ()
if _t("starteng") then
    Engine_One_Start_On ()
else
      Engine_One_Start_Off ()
end
 
function Engine_Two_Start_Off ()
    ipc.writeLvar("L:starteng", 0)
end
function Engine_Two_Start_On ()
    ipc.writeLvar("L:starteng", - 1)
end
 
function Engine_Two_Start_Toggle ()
if _t("starteng") then
    Engine_Two_Start_On ()
else
      Engine_Two_Start_Off ()
end
end
 
 
Now the engine one starts but engine two refuses to start. For engine two you should have -1 

Share this post


Link to post
Share on other sites