April 29, 20224 yr Hi, I want to make a simple script which enables some random failures, as long as I have flipped a button on my Bravo. Below is my current script. For now I just check if a random value in the range from 0 to 1 is 0; then I pick a random action from the possible breakers (JF arrow) or simconnect failures. I bound this script to the key-down event of a toggle-switch on my Bravo, set as repeat on high interval. I do get some very strange behavior. The first time I toggle my switch 1 breaker pops, but that's it. When I then flip it off (no action) and back on, only then they all pop one after another. So question 1: WHy is the first press different from the 2th press? Then, when I set the repeat from fats to slow, it doesn't work anymore. Question 2: What does fast/medium/slow actually do? Finally, with "1 rnd 10" the script works. Eventually I want to (massively) increase the random range. But when I set "10 rnd 0" it stops working. This may be related to the repeat optio, as I was testing with "3 rnd 0" which worked. Does anyone have any experience with this? Ronald 1·rnd·0·==·if{ rndsel{ 1.000·(>L:CIRCUIT_BREAKERS_radio_lts,·Number) 1.000·(>L:CIRCUIT_BREAKERS_xpdr,·Number) 1.000·(>L:CIRCUIT_BREAKERS_ac_blower,·Number) 1.000·(>L:CIRCUIT_BREAKERS_adf,·Number) 1.000·(>L:CIRCUIT_BREAKERS_altntr,·Number) 1.000·(>L:CIRCUIT_BREAKERS_anticoll_lts,·Number) 1.000·(>L:CIRCUIT_BREAKERS_audio_pnl,·Number) 1.000·(>L:CIRCUIT_BREAKERS_autopilot,·Number) 1.000·(>L:CIRCUIT_BREAKERS_beacon,·Number) 1.000·(>L:CIRCUIT_BREAKERS_com1,·Number) 1.000·(>L:CIRCUIT_BREAKERS_com2,·Number) 1.000·(>L:CIRCUIT_BREAKERS_dme,·Number) 1.000·(>L:CIRCUIT_BREAKERS_engine,·Number) 1.000·(>L:CIRCUIT_BREAKERS_fuel_pump,·Number) 1.000·(>L:CIRCUIT_BREAKERS_icomm,·Number) 1.000·(>L:CIRCUIT_BREAKERS_inst_pnl,·Number) 1.000·(>L:CIRCUIT_BREAKERS_ldg_gear_cont,·Number) 1.000·(>L:CIRCUIT_BREAKERS_ldg_gear_lts,·Number) 1.000·(>L:CIRCUIT_BREAKERS_lts_ovhd,·Number) 1.000·(>L:CIRCUIT_BREAKERS_nav_lts,·Number) 1.000·(>L:CIRCUIT_BREAKERS_nav1,·Number) 1.000·(>L:CIRCUIT_BREAKERS_nav2,·Number) 1.000·(>L:CIRCUIT_BREAKERS_pitch_trim,·Number) 1.000·(>L:CIRCUIT_BREAKERS_pitot,·Number) 1.000·(>L:CIRCUIT_BREAKERS_stall,·Number) 1.000·(>L:CIRCUIT_BREAKERS_start,·Number) 1.000·(>L:CIRCUIT_BREAKERS_turn_bank,·Number) 1·(>K:TOGGLE_PITOT_BLOCKAGE) 1·(>K:TOGGLE_STATIC_PORT_BLOCKAGE) 1·(>K:TOGGLE_ELECTRICAL_FAILURE) 1·(>K:TOGGLE_ENGINE1_FAILURE) 1·(>K:TOGGLE_VACUUM_FAILURE) 1·(>K:TOGGLE_HYDRAULIC_FAILURE) 1·(>K:TOGGLE_LEFT_BRAKE_FAILURE) 1·(>K:TOGGLE_RIGHT_BRAKE_FAILURE) 1·(>K:TOGGLE_TOTAL_BRAKE_FAILURE) 1·(>K:TOGGLE_ENGINE1_FAILURE) 1·(>K:TOGGLE_VACUUM_FAILURE) } }
April 29, 20224 yr Commercial Member That syntax won't work properly. Be mindful of the limitation that the manual states: Quote There can be only (>K events or AAO commands inside the braces {}. Variable assignments, like you do with the LVars, are not part of the plan. If the LVar assignments work, they are doing it by accident. The "1.000" and "1" parts are ignored, I would lose them completely (you are supposed to wrap the LVar code in scripts). And I would add a space before each line break, just to be on the safe side. Why are you setting this to repeat? I don't understand the use case here. What is supposed to happen when you press the button? rnd is an integer operator. It returns an integer number between zero and (range - 1). So "1 rnd" will always yield 0. "10 rnd" yields random numbers between 0 and 9. "0 rnd" returns "nothing", I think that this causes an internal error. Edited April 29, 20224 yr by Lorby_SI LORBY-SI
April 29, 20224 yr Author My goal is that I can “arm” failures. So once I activate it, the script gets executed continuously and there is a (extremely) small chance it triggers a failure. There is a great tool for the sim-events failures, but setting LVars is quite tricky. So I had hoped to use your great tool for it 😜. But perhaps it’s better to just make a small complementary FSUIPC app for the LVar events… oh, and at the moment the script does work (as long as I set it to a fast repeat and a 1 out of 2 chance. I did see all the breakers pop one after another, ánd got a vacuum failure
April 29, 20224 yr Commercial Member Why don't you use an Automated Aircraft Script if it is to be executed continuously? You could use an internal LVar to arm it. And a really large rnd value, so it doesn't trigger all the time? Like "(L:trigger) 10000 rnd 25 < and if{..." or something. Or wrap all this into a script file that is looping inside with "(GOTO" once it has been activated. And call that script file with a button press? Edited April 29, 20224 yr by Lorby_SI LORBY-SI
Archived
This topic is now archived and is closed to further replies.