Jump to content
Sign in to follow this  
Guest A320 Co-Pilot

Increase Decision Height

Recommended Posts

Guest A320 Co-Pilot

To get my Virtual FO to help with Take Off, I am using increase decision height, as I can assign a button on a joystick for this via the assignments in FS2004. I then want to be able to use this to command a virtual FO to raise flaps when I tell him to.Code for the Decision Height:%((A:Decision Height, Numbers))%!03d!I am using a string for the time being so I can see what number the decision height it set to.I am hoping some one can help me out with this, when the decision height is increase by 10 this then plays a sound and move the flaps up one position. The decision height starts at 100 when I first start the sim. the code I have so far is:(L:Takeoff,bool) if{ (A:Decision Height, Numbers) 110 (L:DH,number) && if{ 1 (>L:FO_Sound_Flap5,enum) (>K:FLAPS_2) } } (>L:DH,number) The problem is this just keeps playing the sound and setting the flaps to position 2. I have tried a few others but they have not worked either. I will keep trying but if anyone else has any ideas then I would be extreamly greatful.

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Another code I have tried:(L:Takeoff,bool) if{ (A:Decision Height, Numbers) 110 == (L:DH,number) && if{ 1 (>L:FO_Sound_Flap5,enum) (>K:FLAPS_2) } } (A:Decision Height, Numbers) (>L:DH,number) this sets the flaps to 5 like the other one but the decision height has to be increase for it to work the other code sets flaps 5 and plays the sound with out increasing the decision height. So the only problem with the above code is it plays the sound all the time.

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

I manged to solve the problem, this is the working code:(L:Takeoff,bool) if{ (A:Decision Height, Numbers) 110 == (L:DH1,number) ! && if{ 1 (>L:FO_Sound_Flap1,enum) 1 (>L:DH1,number) (>K:FLAPS_1) } } I now have a different kind of problem, If I press the increase decision height button by accident, this then increase the decision height number, and plays the sound and sets the flaps when I do not want it to, so I need to find some way of only being able to keep the decision height number to 100 untill certain events are established. Flaps are not usally started to be retracted untill above 1000ft, so I could use Radar Height, lets say it has to be greater than 1000ft but after 4 hours of trying I still can not get it to work.The codes I have tried(L:Takeoff,bool) if{ (A:Radio Height, Feet) 950 < ! && if{ 1 (A:Decision Height, Numbers) 100 (>A:Decision Height, Numbers) } (L:Takeoff,bool) if{ (A:Radio Height, Feet) 950 < && if{ 1 (A:Decision Height, Numbers) 100 (>A:Decision Height, Numbers) } } (L:Takeoff,bool) if{ (A:Radio Height, Feet) 950 < == if{ 1 (A:Decision Height, Numbers) 100 (>A:Decision Height, Numbers) } } (L:Takeoff,bool) (A:Radio Height, Feet) 950 < && if{ 1 (A:Decision Height, Numbers) 100 (>A:Decision Height, Numbers) } } (L:Takeoff,bool) if{ (A:Radio Height, Feet) 950 < and if{ 1 (A:Decision Height, Numbers) 100 (>A:Decision Height, Numbers) } } (L:Takeoff,bool) if{ 0 (A:Decision Height, Numbers) 100 (>K:INCREASE_DECISION_HEIGHT) (>K:DECREASE_DECISION_HEIGHT) } This code is what I use when the Takeoff swich is not armed, keeps the decision height to 100, but no good when the takeoff switch is on. If I use this code when the takeoff switch is on, it does keep the Decision Height to 100, but when I press the button it increases to 110 for a split second and plays the sound and sets the flaps, I am also looking for a way to reset the Decision Height to 100 when the Takeoff Switch is turned of after takeoff. Tried this but no good(L:Takeoff,bool) if 0 (A:Decision Height, Number) 100 (>A:Decision Height, Number)Anyone have any idea's ?

Share this post


Link to post
Share on other sites

Hi,You could try to add behind the code somewhere:.....code.....quit }or use something like:(L:Condition,enum) x == if{ (L:Var,number) 0 == if{ 1 (>L:Var,number) 1 (>L:Flap/Gear/Sound,number) } } els{ 0 (>L:Var,number) } Hope it helps, Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi,I think you need to use another approach: test the occurence of the event and proceed accordingly.For example, if you use a joystick button tied to INCREASE_DECISION_HEIGHT event to command an action and play a sound, on the section in a gauge:(pseudocode)if takeoff and radar altitude > 1000 and whateverthen play sound, raise the flaps,etcelse do nothingThis way you don't have to care about "Decison Height" AVar's value, (all those lines posted in the message above) because it is useless under these circumstances, you only need to know that the event has been fired (ie the button pressed).Tom

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Hi I think Tom's way is the best way to go, but I am not sure how to add an ON EVENT into the code I already have or to code it from scratch. I have looked around the forum and though a lot of xml codes I have and I am unable to find an example.To get an On Event to work does it have to be coded like a Code. ie like this: if{ (L:Takeoff, bool) (A:Radio Height, Feet) 900 < (L:DH,number) ! && if{ 1 (>L:FO_Sound_Flap1,enum) 1 (>L:DH,number) (>K:FLAPS_1) } } or can it just be added like a click event ie: if{ (L:Takeoff, bool) (A:Radio Height, Feet) 900 < (L:DH,number) ! && if{ 1 (>L:FO_Sound_Flap1,enum) 1 (>L:DH,number) (>K:FLAPS_1) } } These are not tested, so I do not know if they work. I will have a play around and see if I can work it out, but if someone could point me in the right direction, I would be very greatful.

Share this post


Link to post
Share on other sites

Russell,Should be easier for you to place the structure at the bottom of the gauge, after the ...... and BEFORE the end. (L:Takeoff, bool) (A:Radio Height, Feet) 900 > && if{ 1 (>L:FO_Sound_Flap1,enum) (>K:FLAPS_1) }This will play the sound and command flaps up as long as takeoff mode is active AND radio height is greater than 900 feetBear in mind that you'll have to add more control to avoid repeating the event if you press the button again after flaps are up.Tom

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

HiWith the help of Tom I have now got flaps that are retracted by the FO when the decision height is increased.Working code:Flap Retract via a Key/Joystick ButtonFlaps to Position 1 - Flaps 5 to Flap 1 (L:Takeoff, bool) (A:Radio Height, Feet) 900 > && (L:RH,number) ! && if{ 1 (>L:FO_Sound_Flap1,enum) 1 (>L:RH,number) (>K:FLAPS_1) } Flaps Up (L:Takeoff, bool) (A:Radio Height, Feet) 900 > (A:FLAPS HANDLE INDEX, enum) 1 == && (L:RH1,number) ! && if{ 1 (>L:FO_Sound_Flapup,enum)(>L:RH1,number) (>K:FLAPS_UP) } I thought I would take this another step forward and do and after take off checklist, again using increase decision height as a command button, so at 7000ft user presses the joystick button and starts the after start checklist, and then replies using the increase decision height button again, this takes 3 sound files so needs three on events. so the first on event was easy: working code (L:AfterTakeoff,bool) (A:Indicated Altitude, feet) 6000 < && (L:ATOC,number) && if{ 1 !(>L:FO_Sound_ATOCS,enum) 1 (>L:ATOC,number) 1 (>L:NextChecklist,number) } (A:Indictaed Altitude,Feet) is less than for testing purposes.To get the second one to play is where I have a problem, I need something different to A:Indicated Altitude,feet so it plays the different sound files only when the increase decision height is pressed again, so I thought if the first on event I could turn on a L:Var switch, this could then be added to the code and the A:Indicated Altitude,feet could be taken out and then as the L:Var switch is turned on at the end of the code it could replace A:Indicated Altitude,feet, it would not activated the second on event untill the joystick button was click again, I was wrong. This is the code I have for the second on event: (L:AfterTakeoff,bool) (L:NextChecklist,number) && (L:ATOC1,number) ! && if{ 1 (>L:FO_Sound_UpFlaps,enum) 1 (>L:ATOC1,number) 0 (>L:NextChecklist,number) } } The first on event works as it should do but as soon as I add the above code both sounds play, I have made a test switch to make sure L:NextChecklist,number is turned on and it is. I have tried all the codes I used in the takeoff gauge and none work. So how do I get the first on event to turn ie a switch on, without starting the second on event untill the button is pressed again ?

Share this post


Link to post
Share on other sites

Hi,To avoid the effect described, just put all the controlling code into one only : if takeoff then do this if aftertakeoff then do thisetcTomAnd ensure the main conditionals are excluyent.Tom

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

HiThe takeoff part is ok, as at 5000ft the takeoff switch is turned off automatically, and then After Takeoff switch is armed. I would also like to keep these seperate as I am not sure how to link code together so it is going to be a challenge to get the three on events to work.

Share this post


Link to post
Share on other sites

<>Russell, you're focusing wrong on the problem. Your challenge should be to understand how to link the code together and NOT to use a set of because it could seem easier to program. If you can't solve the conditionals in only one , it would be difficult and a waste of time trying to solve using many of them, because each one will execute in sequence when the event is fired. Tom

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Hi TomI agree I was focusing on the wrong problem, I have now linked the three on events and they work perfectly. As I said in the post before Takeoff Switch has nothing to do with the After Take Off Switch, when one is on the other is off, so there is no way that the After Take Off Switch can trigger the Takeoff switch on events and visa versa, I will how ever link the two on events in the Takeoff switch as it is a much better way to do it. Thanks for the help so far, This project has now got a little bigger, I want to see how much more I can get my Virtual First Officer to do, and with the new xml programing I have learnt I think that could be quite a lot.Working code (L:AfterTakeoff,bool) (A:Indicated Altitude, feet) 6000 < && (L:ATOC,number) ! && if{ 1 (>L:FO_Sound_ATOCS,enum) 1 (>L:ATOC,number) 1 (>L:NextChecklist,number) } els{ (L:AfterTakeoff,bool) (L:NextChecklist,number) && (L:ATOC1,number) ! && if{ 1 (>L:FO_Sound_UpFlaps,enum) 1 (>L:ATOC1,number) 1 (>L:NextChecklist1,number) } els{ (L:AfterTakeoff,bool) (L:NextChecklist1,number) && (L:ATOC2,number) ! && if{ 1 (>L:FO_Sound_ATOCF,enum) 1 (>L:ATOC2,number) 0 (>L:NextChecklist1,number) } }

Share this post


Link to post
Share on other sites

Hi,Nice stuff!Do you miss a }?Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Hi JanIn answer to your question I do miss a }. When I first linked the On Events together I linked On Event 1 and 2, and then got them to work, I then added the third On Event and to start with it did not work, at first I thought it was the sound not playing, but after a couple of tests the sound worked ok, so it was not that. So after reading the code a couple of times, the only place I could see where there could be a problem was where the third On Event joined the second On Event, so I moved the } from the end of the second On Event to the end of the Third On Event and it worked perfectly. I thought that all { should have a } but do that in this code and it does not work.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...