Jump to content
Sign in to follow this  
n4gix

Help with slat XML gauge

Recommended Posts

HiOnce again Im stuck and wondering if anybody can help.Ive knocked up a simple XML gauge which works but is firing off all the time preventing all the exits form openingOk what Im trying to do is have slats(animated and set up as flaps) which auto pop out at a certain AOA,but are locked closed when the spoilers/speed brake is out(the locking animation) (A:SPOILERS RIGHT POSITION,position) 0 == (A:INCIDENCE ALPHA, degrees) 4 > && if{ (>K:FLAPS_DOWN) } els{ (>K:FLAPS_UP) } Thanks In AdvanceWarwick

Share this post


Link to post
Share on other sites

You should never put a key_event in an if-else construct... much less in a tag...


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

In principle, your gauge should spend most of its time doing nothing - on any given gauge update, if the flaps are configured correctly, nothing should happen. You have not provided a 'do nothing' option, that's why there is always an event being triggered. Remember, you only want to trigger the flaps event if it is needed. Your unconditional K:Flaps_Up command in the 'else' brackets needs to be conditional on the flaps needing to be retracted - you need a separate test on the two variables here.The other thing - you are using the spoilers variable in your test, but your event is for the flaps. If the slats are set up as flaps, you need to be testing the flaps variable, not the spoilers variable.Doug

Share this post


Link to post
Share on other sites

Hi DougThanks for the reply I think I get what your saying :)Im using the spoiler Purley as a locking event nothing else as I can use its keyframe animation in the VC to show a locked/unlocked statis Well its 5am Im gunna get some sleep and then hit notepad again Thanks AgainWarwick

Share this post


Link to post
Share on other sites

Hi,A question:Is that also true for statements like for example:(A:RIGHT WHEEL RPM,rpm) 2 > (L:ground,bool) and if{ 0 (>L:ground,bool) } And if so, how else?What to do with statements like:(A:Indicated Altitude,feet) (>L:Cabin Altitude,feet)(L:Cabin Altitude,feet) This means continous commands....(At the moment chasing for "wrong" code because of bad FPS)Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest Matthias Lieberecht

Hi Jan,About your first example:This example will not continously command a "switch" action because the command will only proceed if the right wheel rpm is higher than 2 and your L:ground,bool is true. If both things are true, the code will set L:ground,bool to false and so your code will no longer proceed. Except the checking of the if command, it's a "one time" event.About example two:Yes, this is a continous command, but I don't think that you have another chance to realize it. I assume that you always need the value of the indicated altitude in you own variable L:Cabin Altitude. I see no other way to do this than a continous scanning and hand-over of the altitude. Well, you could scan if both values are not equal and just in this case hand-over the altitude to your L: variable, but I don't think that this really speeds up your FPS.Generally you have a bigger problem with key commands, but here a continous action could be solved with a second if command. For example: If you have a couple of terms for an if command to move the flaps fully up, create the if command for your terms and then, within the if comand, a second if question which checks the flap position and only works if the flaps are not up:Term1 = true and Term2 = true if( flaps are not up if( move flaps up ) ) els( flaps are not down if( move flaps down ) )The above example is an easy way to have two key commands in one codeline without having a continous action in your code.Best RegardsMatthias

Share this post


Link to post
Share on other sites

Matthias,Thanks for the explications.Doug's Debuggers are off great help and i was able to solve the continuus Key firing problems in my panel.Another question:I notice a serious drop (50%!) of FPS by putting all my code in one gauge, for example in the overhead and pedestal panels.I see others having all gauges apart.But also the tinmouse 737 has all code © in one gauge with very good FPS!What is better?Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

As has already been mentioned, neither of your examples will cause a problem. Continuous updating of variables is common practice, no matter how you code them.The only problem with "continuous events" is, well... the "events" part! :)If an "event" is being continuously fired, it will often prevent FS from scanning the keyboard properly to intercept and interpret keypresses, and may also block joystick or other controller inputs as well.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Hi AllWell There is just to much I dont know about xml,If I had a gauge to compare this with then perhaps Id make progress,after 3 5am morning trying to get 1 gauge to work IM BEAT!!!!!! hell it only took me 4hrs to knock up a working stop watch. I know its got to do with the syntax a space here or a space there,there are just to many rules for this laungage.My hat of to the ones who make sense outa this stuff Cheers Warwick

Share this post


Link to post
Share on other sites

Bill,Well, that is reassuring.Not worrying anymore about (>L:..... etc! (?)Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

> > (A:SPOILERS RIGHT POSITION,position) 0 ==>(A:INCIDENCE ALPHA, degrees) 4 > && if{>(>K:FLAPS_DOWN) }> els{ (>K:FLAPS_UP) }> Warwick, let's translate this into "pseudo-English" to see if the problem becomes more clear:If "spoilers are closed" & "incidence alpha" is > 4then"lower the flaps" (and keep doing this until they break!)else"raise the flaps" (and keep doing this until they break!)You need to put some check-code in your logic so that the action (event) is only done ONCE, and not repeated constantly. :)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Hi BillYeah I know that :)My prob is with the flaps Ive looked through every flap xml I can find and no where can I find the syntax most are used in conjunction with case value and in all cases the flaps are used for well flaps.I followed the convo here and downloaded Dougs event gauge (kool tool BTW) and can see the prob.The big prob is I know it can be done,its just finding the right words(cants see the xml gauge from the code) :)here are some Ive come up with but my biggest prob is I dont know if the gauge is not working because I missed a space or a comma somplace or the syntax Ive used for the A: K:,Ive read all I can find on the subject but most of its over me head Im starting to think I might need to use a G:Var (A:SPOILERS RIGHT POSITION,percent) 10 < (A:INCIDENCE ALPHA, degrees) near 4 > && if{ (>A:FLAPS HANDLE PERCENT) 0 < (>K:FLAPS_DOWN) } } els{ (>A:FLAPS HANDLE PERCENT) 1 > (>K:FLAPS_UP) } } and Ive tried using bool (A:SPOILERS RIGHT POSITION,percent) 10 < (A:INCIDENCE ALPHA, degrees) near 4 > && if{ (A:FLAPS HANDLE PERCENT,bool) ! if{ (>K:FLAPS_DOWN) } } els{ (A:FLAPS HANDLE PERCENT,bool) if{ (>K:FLAPS_UP) } } Ive tried L:value (L:SLATS,bool)! if{ (A:INCIDENCE ALPHA, degrees) 4 > if{ (>L:SLATS,bool) ! } } els{ (A:INCIDENCE ALPHA, degrees) 4 < if{ (>L:SLATS,bool) } } (A:SPOILERS HANDLE POSITION,number) 0 < if{ (>L:SLATS,bool) ! if{ (>K:FLAPS_DOWN) } } els{ (>L:SLATS,bool) if{ (>K:FLAPS_UP) } } Ok now ya all had a good belly laugh at my feable attemps,throw this old dog a bone will ya :DThanks Wozza

Share this post


Link to post
Share on other sites

Hello,Numerous problems with syntax for one. You're using store syntax (>) to get a value from a variable in multiple cases. For instance you don't want to say:INCORRECT:(>L:whatever, bool) if{ 1 (>L:put it in here, bool) }Don't put the ">" within the parens for a variable you want to READ, only in a variable you want to WRITE.CORRECT:(L:whatever, bool) if{ 1 (>L:put it in here, bool) }I noticed you were also using the wrong units for at least one variable: (A:FLAPS HANDLE PERCENT,bool) is incorrect. That needs generally needs to be percent (A:FLAPS HANDLE PERCENT,percent).Your simple code example written so it won't fire all the time would be as follows. Note that I used your logic from the previous example. (A:SPOILERS RIGHT POSITION,position) 0 == (A:INCIDENCE ALPHA, degrees) 4 > and if{ (A:Flaps Handle Percent, Percent) 100 != if{ (>K:FLAPS_DOWN) } }els{ (A:Flaps Handle Percent, Percent) 0 != if{ (>K:FLAPS_UP) } } If you still have issues implementing this, fire me off an email and I'll be happy to write it for you, so you can see what's going on. At least try my example above first.--Jon

Share this post


Link to post
Share on other sites

YAHOOOOOOOOOOOOOOOOOOOOOO!!!!you da man Thank you THANK YOU! :Dyou made me very happy chappyHave a look here in a week or so for a new Tigermoth by meYou going on the top of my thank you credits :)Thaks AgainWarwick

Share this post


Link to post
Share on other sites

I'm happy you got it sorted out, thanks to Jon's solution... I could see the problem but I'm a "C++ guy" and don't really know XML at all, but, I'm learning since I am forced to use it in the MakeMDL.parts.xml file... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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...