jfjoubert Posted June 18, 2018 Report Posted June 18, 2018 I am still trying to see if I can optimise my code (clutter wise and not speed wise). I have absolutely no lags or stutters whatsoever. I will upload as soon as I feel it is worthy of sharing. Quote
XPJavelin Posted June 19, 2018 Author Report Posted June 19, 2018 7 hours ago, blocks_off said: if os.clock() > r_trigger_start_time + 22 Ok, I see that... It's clever Quote
XPJavelin Posted June 19, 2018 Author Report Posted June 19, 2018 6 hours ago, jfjoubert said: I am still trying to see if I can optimise my code (clutter wise and not speed wise). I have absolutely no lags or stutters whatsoever. I will upload as soon as I feel it is worthy of sharing. So we have a winner here Quote
XPJavelin Posted June 19, 2018 Author Report Posted June 19, 2018 NOTE : to declutter the code you can transform if os.clock() > r_trigger_start_time +1 then w_acft_flap = 0.5 end into if os.clock() > r_trigger_start_time +1 then w_acft_flap = 0.5 end Quote
blocks_off Posted June 19, 2018 Report Posted June 19, 2018 34 minutes ago, XPJavelin said: NOTE : to declutter the code you can transform if os.clock() > r_trigger_start_time +1 then w_acft_flap = 0.5 end into if os.clock() > r_trigger_start_time +1 then w_acft_flap = 0.5 end Thanks - and with all the thinking my brain can do, I do not know why i've done it as per my original note. Just putting some more lines together in my lunch (for my shutdown routine) looks much neater per your suggestion :- (I've intentionally put the same time on some actions - I want my first officer using all fingers when he can! if r_includeIRS then if os.clock() > r_trigger_start_time + 1 then w_acft_irsL = 0 end if os.clock() > r_trigger_start_time + 2 then w_acft_irsR = 0 end end if os.clock() > r_trigger_start_time + 4 then w_acft_fuelLfwd = 0 end if os.clock() > r_trigger_start_time + 4 then w_acft_fuelLaft = 1 end -- leave on for apu if os.clock() > r_trigger_start_time + 5 then w_acft_fuelRfwd = 0 end if os.clock() > r_trigger_start_time + 5 then w_acft_fuelRaft = 0 end if os.clock() > r_trigger_start_time + 6 then w_acft_winheat_l_side = 0 end if os.clock() > r_trigger_start_time + 6 then w_acft_winheat_l_fwd = 0 end if os.clock() > r_trigger_start_time + 7 then w_acft_winheat_r_side = 0 end if os.clock() > r_trigger_start_time + 7 then w_acft_winheat_r_fwd = 0 end if os.clock() > r_trigger_start_time + 8 then w_acft_pitot_a = 0 end if os.clock() > r_trigger_start_time + 9 then w_acft_pitot_b = 0 end if os.clock() > r_trigger_start_time + 10 then w_acft_hydELEC2 = 0 end if os.clock() > r_trigger_start_time + 11 then w_acft_hydELEC1 = 0 end if os.clock() > r_trigger_start_time + 14 then w_acft_seatbelt = 0 if os.clock() > r_trigger_start_time + 15 then w_acft_beaconLIGHT = 1 Quote
jfjoubert Posted June 19, 2018 Report Posted June 19, 2018 The problem with the above code is that you cannot have it in a function which is only executed once... you will never get to most of the steps. The current code has a conditional check for PREFLIGHT to see that preflightproc_trigger == 0 and beforestartproc_trigger == 0 and OXYTEST == 1 Now this means that the actual code inside the function will only execute once. On the second pass all the above variables will not meet the condition again. So you will never get to os.clock() > r_trigger_start_time + 4 and further. So one possible solution is to change the conditional check to make sure that the code inside the function is repeated until all steps have been completed. This is what is adding to the clutter because now you have to make sure that you don't repeat a previously executed step and and that all steps are still done in the right order. Anyhow, I will upload my lua file (once done) with my modified code for the PREFLIGHT procedure and you guys can then have a look to see if it's not too much clutter in the code. 1 Quote
XPJavelin Posted June 19, 2018 Author Report Posted June 19, 2018 1 hour ago, jfjoubert said: The problem with the above code is that you cannot have it in a function which is only executed once... you will never get to most of the steps. The current code has a conditional check for PREFLIGHT to see that preflightproc_trigger == 0 and beforestartproc_trigger == 0 and OXYTEST == 1 Now this means that the actual code inside the function will only execute once. On the second pass all the above variables will not meet the condition again. So you will never get to os.clock() > r_trigger_start_time + 4 and further. So one possible solution is to change the conditional check to make sure that the code inside the function is repeated until all steps have been completed. This is what is adding to the clutter because now you have to make sure that you don't repeat a previously executed step and and that all steps are still done in the right order. Anyhow, I will upload my lua file (once done) with my modified code for the PREFLIGHT procedure and you guys can then have a look to see if it's not too much clutter in the code. Mmm Well said. Quote
jfjoubert Posted June 19, 2018 Report Posted June 19, 2018 Soon it will be released... I'm just busy testing to avoid a red face. 1 Quote
jfjoubert Posted June 19, 2018 Report Posted June 19, 2018 (edited) As promised... IMPORTANT NOTE TO ALL: This file is not a complete replacement for the original code from @XPJavelin. It simply shows a way of applying some randomness in the procedure steps. Please also note: The code was only modified for the PREFLIGHT Procedure (start with OXYGEN test switch) You can easily change the min and max time (in seconds) for the random delay in the code I re-enabled some of the datarefs and made some "readonly" to be able to do some conditional checks If you don't know FlyWithLUA or LUA or you don't care about the underlying code then wait for an official update from @XPJavelin This will only happen if @XPJavelin wants to incorporate this into his code @XPJavelin I did add comments as far as possible to the code so hopefully it will make sense. Shout if anything is unclear. IXEG_proc.lua Edited June 19, 2018 by jfjoubert 1 Quote
XPJavelin Posted June 19, 2018 Author Report Posted June 19, 2018 thanks @jfjoubert,I will investigate your work, in the mean time, I was working on a revision of my script to include after landing flow with and without APU. I also added altitude constraint for flaps retraction, compatible with the go around triggers, and runway Entry procedure is triggered by left inboard landing light instead of left outboard. Both as suggested by @blocks_off Quote
XPJavelin Posted June 19, 2018 Author Report Posted June 19, 2018 The first thing I can say reviewing your code,you're not lazy ! Quote
blocks_off Posted June 19, 2018 Report Posted June 19, 2018 3 hours ago, jfjoubert said: The problem with the above code is that you cannot have it in a function which is only executed once... you will never get to most of the steps. Yes that is true of the code I posted earlier, but not if taking this into account i.e. it's part of a function as described here. 2 hours ago, XPJavelin said: Mmm Well said. As above Quote
jfjoubert Posted June 19, 2018 Report Posted June 19, 2018 @blocks_off Correct me if I'm wrong but won't your code execute the same steps multiple times until the 22 seconds have passed and r_trigger_shooting_approaches is set to false? It should work if you conditionally check each item and only set it once like this: if os.clock() > r_trigger_start_time +1 then if w_acft_flap ~= 0.5 then w_acft_flap = 0.5 end end Otherwise you might end up hearing all the click sounds in the cockpit when switches are set to a specific position, even though they might already be in that position from a previous loop through the function. Anyway, it could work. I just felt like typing a lot of code... Quote
blocks_off Posted June 19, 2018 Report Posted June 19, 2018 (edited) Hi @jfjoubert You are correct with what you say and it is great fun testing when you move a switch to a different position, then it moves it back but i digress..... I do not hear repeated clicks, there are a few steps where I check for the state and then only set if it is not in the correct position for that routine such as gear handle, start switches. I've had a quick look at your code, and as much as I like the randomness idea, I will park it for now Well done though with that achievement... did you drink a lot of your favorite drink whilst writing it ? Thanks for your reply and interest -Carl Edited June 19, 2018 by blocks_off Quote
jfjoubert Posted June 19, 2018 Report Posted June 19, 2018 55 minutes ago, blocks_off said: did you drink a lot of your favorite drink whilst writing it ? No, I don't drink and code... Quote
XPJavelin Posted June 20, 2018 Author Report Posted June 20, 2018 11 hours ago, jfjoubert said: No, I don't drink and code... Quote
XPJavelin Posted June 20, 2018 Author Report Posted June 20, 2018 I am looking for something simple in my code. It was very convenient to read the FCOM and just translate in a few command lines, in a very straighforward way. I am not sure I am ready to sacrifice simplicity for human delay of actions. 12 hours ago, jfjoubert said: if os.clock() > r_trigger_start_time +1 then if w_acft_flap ~= 0.5 then w_acft_flap = 0.5 end end I like that way of doing however. I will think about it. In the mean time, I was thinking of implementing a GUI menu to set options (F30 of F40, with or without APU...) Quote
XPJavelin Posted June 24, 2018 Author Report Posted June 24, 2018 (edited) During last week end, the download has been corrected and updated to version 3. I suggest you do a full download again for v3.0. (I might upload version 3.1 soon with bug fixes as I have more tests to do, and then you will only have to download the small lua script update) . Now it is possible to set copilot options like flaps settings for landing. It is now possible to set them in the xplane menu. Also, we have now slowed down the copilot for various procedures at some steps, using os.clock without totally removing simplicity in the mean time... :-) Change log * v 3 : Copilot works in a more realistic way, with delays between actions. * v 3 : Options are now changed in X-Plane menu → Fly with Lua entry, instead of cockpit knobs. * v 3 : New option : user can deactivate flaps and gear by F/O. Speedy Copilot_3.pdf Edited June 25, 2018 by XPJavelin new documentation added Quote
XPJavelin Posted June 25, 2018 Author Report Posted June 25, 2018 (edited) I have uploaded the stable version 3.15 ! I had time to test it tonight, find & repair some bugs, both severe and minors. I am confident I have reached a stable state (without severe bug) with nice features now. Therefore, from now on, I will reduce the updates rate ! From version 1 to version 3, I have implemented various ideas thanks to feedback from users (Jean Joubert , Carl) . With this fully operational version 3.15, it's time to freeze the features1. Hope you'll like it. 1Of course, if any user finds a bug, I can certainly publish code revisions as I am fully open to comments. Edited June 25, 2018 by XPJavelin 1 Quote
XPJavelin Posted July 2, 2018 Author Report Posted July 2, 2018 (edited) version 3.3 - removed some bugs, I consider it as final. :-) Edited July 2, 2018 by XPJavelin Quote
XPJavelin Posted August 16, 2018 Author Report Posted August 16, 2018 Now, the little browser for the FFA320 has landed ! Quote
XPJavelin Posted October 31, 2018 Author Report Posted October 31, 2018 Speedy Copilot was updated to version 4 "Halloween" tonight. It's a major overhaul. Quote
posewik Posted November 6, 2018 Report Posted November 6, 2018 (edited) Files proc_sounds/Annoucements are not played. What can be done? Sorry for bad english. I'm sorry plugkin works. I forgot to press a button "PA"/ Edited November 18, 2018 by posewik Quote
XPJavelin Posted January 20, 2019 Author Report Posted January 20, 2019 Hi all, I have uploaded a new revision of Speedy Copilot with small improvements and bug fixes. (4.3). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.