Wednesday at 04:46 PM2 days Either of these should flip the boolean value of (L:SW_SOV_PANELS_Door_Baggage, Bool) This does not work (A:SIM ON GROUND, Bool) 1 == if{ (L:SW_SOV_CONFIG_Simple_Openings, Bool) 0 == if{ IMPLICIT(L:SW_SOV_PANELS_Latch_Baggage_1_1, Bool) (L:SW_SOV_PANELS_Latch_Baggage_2_1, Bool) and if{ (L:SW_SOV_PANELS_Door_Baggage, Bool) ! (>L:SW_SOV_PANELS_Door_Baggage, Bool) } } } This works (A:SIM ON GROUND, Bool) 1 == if{ (L:SW_SOV_CONFIG_Simple_Openings, Bool) 0 == if{ EXPLICIT(L:SW_SOV_PANELS_Latch_Baggage_1_1, Bool) 0 == (L:SW_SOV_PANELS_Latch_Baggage_2_1, Bool) 0 == and if{ (L:SW_SOV_PANELS_Door_Baggage, Bool) ! (>L:SW_SOV_PANELS_Door_Baggage, Bool) } } } | i7-14700KF - 4080 SUPER | 32 GB RAM | Win 11 Pro | HC Bravo | AAO | StreamDeck |
Wednesday at 07:00 PM2 days Commercial Member From my perspective, the two yellow scripts in your post do the exact opposite from each other. They cannot produce the same results.2 hours ago, mrm0508 said:(L:SW_SOV_PANELS_Latch_Baggage_1_1, Bool) (L:SW_SOV_PANELS_Latch_Baggage_2_1, Bool) andThis script returns true when both LVars are true (= have a value of 1.0, Lvars are always Numbers)"1 1 and" results in a value of 1.0 (true)2 hours ago, mrm0508 said:(L:SW_SOV_PANELS_Latch_Baggage_1_1, Bool) 0 == (L:SW_SOV_PANELS_Latch_Baggage_2_1, Bool) 0 == andAnd this script is the exact opposite. You query explicitly if both LVars are false (= have a value of 0.0) Edited Wednesday at 07:07 PM2 days by Lorby_SI LORBY-SI
Wednesday at 07:04 PM2 days Commercial Member On a side note, LVars are always numbers. TMBK, giving them a different unit, like "Bool", has no effect. You can just as well stick with "Number". Just make sure that the value range of the LVar is actually "0 or 1". In most cases, LVars have much larger value ranges, like 0 to 30 or 0 to 100. They are often used to control animations, and their value represents the "frame" that the animation is currently at.Another note: For AAO "0" always means "false". But many operators tolerate "true" as being "not 0". Edited Wednesday at 07:05 PM2 days by Lorby_SI LORBY-SI
Wednesday at 07:45 PM2 days Author These variables are compartment latches, they are either closed (0) or open (1), I am trying to check if they are all open prior to trying to open the compartment (L:SW_SOV_PANELS_Door_Baggage, Bool) which also is either closed (0) or open (1). So, if both latches are closed (both 0) the door won't open and if they are both open, then the door can open. So, I am checking to see if both latches are the same (1 or 0) with "and" and that doesn't work, it only works if I explicitly use "0 ==" or "1 ==" in the expression. It great simplifies the code if I can just use the implicit version.Here is the mousrects code for the clickspot I am working on. This code does not run in AAO as written: (A:SIM ON GROUND, Bool) 1 == if{ (L:SW_SOV_CONFIG_Simple_Openings, Bool) 0 == if{ (L:SW_SOV_PANELS_Latch_Baggage_1_1, bool) (L:SW_SOV_PANELS_Latch_Baggage_2_1, bool) (L:SW_SOV_PANELS_Latch_Baggage_3_1, bool) (L:SW_SOV_PANELS_Latch_Baggage_4_1, bool) (L:SW_SOV_PANELS_Handle_Baggage, bool) and and and and if{ (L:SW_SOV_PANELS_Door_Baggage) ! (>L:SW_SOV_PANELS_Door_Baggage) } } els{ (L:SW_SOV_PANELS_Door_Baggage) ! (>L:SW_SOV_PANELS_Door_Baggage) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_1_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_2_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_3_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_4_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Handle_Baggage) } } This is what I did that worked: (A:SIM·ON·GROUND,·Bool)·1·==·if{·(L:SW_SOV_PANELS_Door_Baggage,·bool)·0·==·if{·(L:SW_SOV_PANELS_Latch_Baggage_1_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_1_1,·Number)·(L:SW_SOV_PANELS_Latch_Baggage_2_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_2_1,·Number)·(L:SW_SOV_PANELS_Latch_Baggage_3_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_3_1,·Number)·(L:SW_SOV_PANELS_Latch_Baggage_4_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_4_1,·Number)·(WAIT:3000)·(L:SW_SOV_PANELS_Handle_Baggage,·Number)·!·(>L:SW_SOV_PANELS_Handle_Baggage,·Number)·(WAIT:1000)·(L:SW_SOV_PANELS_Door_Baggage,·bool)·!·(>L:SW_SOV_PANELS_Door_Baggage,·bool)}} ·(L:SW_SOV_PANELS_Door_Baggage,·bool)·1·==·if{·(L:SW_SOV_PANELS_Door_Baggage,·bool)·!·(>L:SW_SOV_PANELS_Door_Baggage,·bool)·(WAIT:5000)·(L:SW_SOV_PANELS_Handle_Baggage,·Number)·!·(>L:SW_SOV_PANELS_Handle_Baggage,·Number)·(WAIT:1000)·(L:SW_SOV_PANELS_Latch_Baggage_1_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_1_1,·Number)·(L:SW_SOV_PANELS_Latch_Baggage_2_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_2_1,·Number)·(L:SW_SOV_PANELS_Latch_Baggage_3_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_3_1,·Number)·(L:SW_SOV_PANELS_Latch_Baggage_4_1,·Number)·!·(>L:SW_SOV_PANELS_Latch_Baggage_4_1,·Number)·} Edited Wednesday at 08:52 PM2 days by mrm0508 Added code I used that worked to toggle the baggage door | i7-14700KF - 4080 SUPER | 32 GB RAM | Win 11 Pro | HC Bravo | AAO | StreamDeck |
Thursday at 09:59 AM1 day Commercial Member 14 hours ago, mrm0508 said:This code does not run in AAO as writtenCorrect. Behavior code must always be adapted for AAOs RPN dialect. Most importantly, all LVars must have a unit (like ,Number). Otherwise AAO will treat them as internal, and will not sync them with the simulator. LORBY-SI
Thursday at 10:55 AM1 day Commercial Member 15 hours ago, mrm0508 said:So, I am checking to see if both latches are the same (1 or 0) with "and" and that doesn't workThe boolean "and" only checks if both vars are true/1. It does not check if they are the same, that would be the "=="'1 1 and' => true/1'0 0 and' => false/0'1 0 and' => false/0'0 1 and' => false/0********'1 1 ==' => true/1'0 0 ==' => true/1'1 0 ==' => false/0'0 1 ==' => false/0 Edited Thursday at 11:00 AM1 day by Lorby_SI LORBY-SI
Thursday at 11:04 AM1 day Commercial Member There is another problem that AAO will have with the behavior script. AAOs RPN parser does not propagate variable changes inside the same script. I've altered the code it so it uses a register instead:(A:SIM·ON·GROUND,·Bool)·1·==·if{· ·(L:SW_SOV_CONFIG_Simple_Openings,·Number)·0·==·if{· ··(L:SW_SOV_PANELS_Latch_Baggage_1_1,·Number)· ··(L:SW_SOV_PANELS_Latch_Baggage_2_1,·Number)· ··(L:SW_SOV_PANELS_Latch_Baggage_3_1,·Number)· ··(L:SW_SOV_PANELS_Latch_Baggage_4_1,·Number)· ··(L:SW_SOV_PANELS_Handle_Baggage,·Number)· ··and·and·and·and·if{· ···(L:SW_SOV_PANELS_Door_Baggage,·Number)·!·(>L:SW_SOV_PANELS_Door_Baggage,·Number)· ··}· ·}· ·els{· ··(L:SW_SOV_PANELS_Door_Baggage,·Number)·!·s0· ··l0·(>L:SW_SOV_PANELS_Door_Baggage,·Number)· ··l0·(>L:SW_SOV_PANELS_Latch_Baggage_1_1,·Number)· ··l0·(>L:SW_SOV_PANELS_Latch_Baggage_2_1,·Number)· ··l0·(>L:SW_SOV_PANELS_Latch_Baggage_3_1,·Number)· ··l0·(>L:SW_SOV_PANELS_Latch_Baggage_4_1,·Number)· ··l0·(>L:SW_SOV_PANELS_Handle_Baggage,·Number)· ·}· }· Edited Thursday at 11:09 AM1 day by Lorby_SI LORBY-SI
Thursday at 03:35 PM1 day Commercial Member To explain this a bit.The biggest problem with the behavior code is this part: (L:SW_SOV_PANELS_Door_Baggage) ! (>L:SW_SOV_PANELS_Door_Baggage) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_1_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_2_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_3_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Latch_Baggage_4_1) (L:SW_SOV_PANELS_Door_Baggage) (>L:SW_SOV_PANELS_Handle_Baggage) For one, none of the LVars has a unit - which means that AAO will treat them as internal vars, and never send them to the sim. The solution is to add at least the default ", Number"Second, the AAO RPN parser works a little differently than the sim. In the first line, the SW_SOV_PANELS_Door_Baggage is changed. In the subsequent lines, this new value is written to a bunch of other LVars. The AAO parser doesn't work like that, it will replace all occurences of SW_SOV_PANELS_Door_Baggage with its current value before executing the script. As a result, all the LVars will receive the OLD value of SW_SOV_PANELS_Door_Baggage, not the new one. One solution I have outlined above, and that is using registers, which are updated at runtime. Another solution would be to apply the "!" operation to all assignments of the SW_SOV_PANELS_Door_Baggage: (L:SW_SOV_PANELS_Door_Baggage, Number) ! (>L:SW_SOV_PANELS_Door_Baggage, Number) (L:SW_SOV_PANELS_Door_Baggage, Number) ! (>L:SW_SOV_PANELS_Latch_Baggage_1_1, Number) (L:SW_SOV_PANELS_Door_Baggage, Number) ! (>L:SW_SOV_PANELS_Latch_Baggage_2_1, Number) (L:SW_SOV_PANELS_Door_Baggage, Number) ! (>L:SW_SOV_PANELS_Latch_Baggage_3_1, Number) (L:SW_SOV_PANELS_Door_Baggage, Number) ! (>L:SW_SOV_PANELS_Latch_Baggage_4_1, Number) (L:SW_SOV_PANELS_Door_Baggage, Number) ! (>L:SW_SOV_PANELS_Handle_Baggage, Number) I know, this doesn't really make sense. It is one of those things that you just have to know about AAO. It has been implemented this way at the beginning. Over the years everybody worked around it in code. Now it is too late to change it, because that change would probably invalidate a large amount of existing scripts. Edited Thursday at 03:36 PM1 day by Lorby_SI LORBY-SI
15 hours ago15 hr Author Wow, thank you so much for expanding on this. I have little knowledge of how the sim and AAO treat RPN differently, I end up with a lot of trial and error.....mostly error :) Much appreciated. | i7-14700KF - 4080 SUPER | 32 GB RAM | Win 11 Pro | HC Bravo | AAO | StreamDeck |
Create an account or sign in to comment