johnk515 Posted October 27, 2017 Report Posted October 27, 2017 I'm trying to add mjc's anti collision lights to a 3 way switch. The name is OHD_EXT_LT_ACOL_SW. I tried using -1, 0, 1 to move the switch on the panel to have just the beacon on , off, or anti collision / beacon on. That didn't do. I'm not very good with LUA, how to have the switch go down when flipping my switch down or flipping the switch up add the anti collision, or off when switch is in the middle. Some one said to try a mouse macro, but no luck with that either. Any one have away to put this in a macro or LUA file? This is FSUIPC 4. FSX:SE
Pete Dowson Posted October 27, 2017 Report Posted October 27, 2017 8 hours ago, johnk515 said: I'm trying to add mjc's anti collision lights to a 3 way switch. The name is OHD_EXT_LT_ACOL_SW. I tried using -1, 0, 1 to move the switch on the panel to have just the beacon on , off, or anti collision / beacon on. That didn't do. I don't recognise that name. Are you talking about a local panel variable (L:Var)? Have you observed it changing -1, 0, 1 when you operate the swtch on the panel? Also check the actual lights, -- look at the outside view. Quite often changing the L:Var makes the action happen, but just doesn't move the panel switch -- if that's the case, there MAY be abother variable to do that, but more likely it can only be done by mouse. 8 hours ago, johnk515 said: I'm not very good with LUA, how to have the switch go down when flipping my switch down or flipping the switch up add the anti collision, or off when switch is in the middle. Some one said to try a mouse macro, but no luck with that either. I can't comment on either because you show no examples of your attempts. Mouse macros are not likely to be available if the aircraft is relatively new. They only apply to panels made to the same spec as the FS2002 panels SDK for C/C++ gauges. That used to apply to many aircraft, through FS2002 to fSX, but newer ones use different methods and/or XML. Pete
johnk515 Posted October 28, 2017 Author Report Posted October 28, 2017 I was trying it in the mjc84.ini file, but that didn't work. Some one on their site suggested using lua to change it. They said "There I use the LVar L:OHD_EXT_LT_ACOL_SW with -1, 0 and +1." My problem is that when I look at lua, it can get confusing. I have a 3 way switch J2:21, 22, 23. Just trying to tell it, if I have the switch in the middle 22 and switch to 21 it flips the switch up or I switch it down to 23, the switch in the plane flips down. I attached a lua file that works some what. I start with the switch in the middle b22. when I flip the switch to b21 the red beacon light comes on, but when I switch back to b22, it doesn't switch back to off. I have to flip up again and it goes off and flip back down to the off position. It does the same thing when flipping down to b23, the anti-collision lights come on, but stay on if I flip the switch back to b22. I have to flip down, then up again. Can some one look and tell me what I'm missing? acol.lua
Pete Dowson Posted October 29, 2017 Report Posted October 29, 2017 14 hours ago, johnk515 said: My problem is that when I look at lua, it can get confusing. I have a 3 way switch J2:21, 22, 23. Just trying to tell it, if I have the switch in the middle 22 and switch to 21 it flips the switch up or I switch it down to 23, the switch in the plane flips down. I attached a lua file that works some what. I start with the switch in the middle b22. when I flip the switch to b21 the red beacon light comes on, but when I switch back to b22, it doesn't switch back to off. I have to flip up again and it goes off and flip back down to the off position. You say the three positions on your switch are all recognised as 'button numbers'? 21, 22 and 23? If so, why does the Lua only process ipcPARAM values -1 and +1? What about when it is 0? And the Lua file seems far too complicated. Why are you reading the panel switch position first? If it has three positions settable why not just set them? That would be very few lines. Perhaps, also, you should show me the assignment likes for J2, 21,22 and 23, from your FSUIPC INI file. Pete
johnk515 Posted October 29, 2017 Author Report Posted October 29, 2017 Here's the settings in FSUIPC for mjc D8-400: 25=P2,22,CL13:R,0 -{Lua acol}- 26=P2,21,CL13:R,-1 -{Lua acol}- 27=P2,23,CL13:R,1 -{Lua acol}-
Pete Dowson Posted October 29, 2017 Report Posted October 29, 2017 On 10/29/2017 at 7:59 PM, johnk515 said: 25=P2,22,CL13:R,0 -{Lua acol}- 26=P2,21,CL13:R,-1 -{Lua acol}- 27=P2,23,CL13:R,1 -{Lua aco Well, as I said, one of those isn't being used, it is? (P2,22). I'm assuming Lua file #13 is the Lua file you showed me. Also, the fact that you are toggling positions in the gauge with the two buttons which are actually doing anything suggests that the -1 and +1 values are actually telling the gauge to toggle the switch position. Why don't you have anything programmed for the 0 value? You may want to study the behaviour of that L:Var more carefullt before actually trying to work out how to program your switch. Use the Lua example provided to log the L:Var values as they change. I don't recall its name off-hand, but they are all described in the Lua document. The examples are in the ZIP file. Pete
johnk515 Posted October 30, 2017 Author Report Posted October 30, 2017 I got it all fixed. I removed a lot of stuff not needed. So, it works fine with only 3 actions, -1 up, 0 off, 1 down. Works great, thanks for the help Pete.
Pete Dowson Posted October 30, 2017 Report Posted October 30, 2017 4 hours ago, johnk515 said: I got it all fixed. I removed a lot of stuff not needed. So, it works fine with only 3 actions, -1 up, 0 off, 1 down. Very good. Could you show your final working result please? Might help others who'll refer to this thread. Thanks,Pete
Pete Dowson Posted October 31, 2017 Report Posted October 31, 2017 Thanks. But that could be even simpler, just this one line: ipc.writeLvar("L:OHD_EXT_LT_ACOL_SW", ipcPARAM) That does exactly the same. Pete
johnk515 Posted November 1, 2017 Author Report Posted November 1, 2017 I'll do that. Finding out new things every day.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now