Jump to content

taguilo

Members
  • Content Count

    883
  • Donations

    $0.00 
  • Joined

  • Last visited

Everything posted by taguilo

  1. It's ok Javier :-)Y feliz Navidad para vos tambien!(And Merry Christmas to you as well!)Tom
  2. Hi,Your code: (P:Zulu time, seconds) 1 % 2 * flr if{ (A:Airspeed select indicated or true, knots) (>L:Airspeed t1, number) } els{ (A:Airspeed select indicated or true, knots) (>L:Airspeed t2, number) } (L:Airspeed t1, number) (L:Airspeed t2, number) - (>L:Airspeed diference, number)won't work as expected because you're continiously updating either LAirspeed var. This code works fine for one sec rate :(P:Absolute time,seconds) abs (L:Time Stamp,seconds) - abs 1 > if{ (A:Airspeed select indicated or true,feet per second) s0 (L:Airspeed previous, feet per second) - (>L:Airspeed diff, feet per second)l0 (>L:Airspeed previous, feet per second)(P:Absolute time,seconds) abs (>L:Time Stamp,seconds)}feet/sec gives a better handling number.As for the HUD part, maybe Jan or other "HUD experts" could give you some help.Tom
  3. >Well did a search and its over my head by a mile:)>it also contains a dirty four letter word MATH >UUUGGG I can here my old maths teacher now laughing aloudWell, I guess it is more logics than maths (indeed maths scared me bad in school time :-))You might try something like this (not tested)0.90010384 (A:Elevator Position,percent) 100 / 16383 *"D" macro is the damping force, usual values are from 0.8 to 0.95, you can experiment changing this number until get the result desired.Then, in the ,(A:AIRSPEED MACH,mach) 0.8 > @ElevPos @ElevLimit < and if{ (L:ElevPos,number) @D * 1.0 @D - @ElevLimit * + d (>L:ElevPos,number) (>K:ELEVATOR_SET) } els{ @ElevPos (>L:ElevPos,number) }Tom
  4. Hi,If what you need is a smooth application of down elevator, you can use Arne Bartel's "exponential averaging" formula (yn1=yn*D+(1.0-D)xn1) posted in this forum, for "damping" the increment.Tom
  5. Hi,you might try this one (not tested)(L:Starter,bool) (A:Turb Eng1 N2,percent) 50 > ! * (>L:Starter,bool) (L:Ignition,bool) 1 == (L:Starter,bool) 1 == (A:ELECTRICAL MASTER BATTERY,bool) 1 == && && if{ (>K:TOGGLE_STARTER1) }or maybe this "polished"(L:Starter,bool) (A:Turb Eng1 N2,percent) 50 > ! *(>L:Starter,bool) (L:Ignition,bool) (L:Starter,bool) (A:ELECTRICAL MASTER BATTERY,bool) and and if{ (>K:TOGGLE_STARTER1) }Notice that bool vars can be tested as is, because always return 0 or 1 (no need to compare to 1 == or 0 == )Hope this helpsTom
  6. Also, if you find difficult/annoying to code %{if}%{else}% etc in strings structures, or need to reference the same vars several times, you may as well use macros like ((A:RADIO HEIGHT,feet) 500 > (L:vnav,enum) 0 == (L:flch,enum) 0 == (A:Autopilot altitude lock,bool) and and and if{ 'ALT HOLD' sp0 } (L:vnav,enum) 1 == (A:VERTICAL SPEED,ft/min) abs 100 > and if{ 'VNAV PTH' sp0 } etc... l0Then %(@Mac1)%!s! or even use registers directly ((A:RADIO HEIGHT,feet) 500 > ...etc if{ 'ALT HOLD' sp0 } etc...Then %(l0)%!s!Tom
  7. >Right on the head Rob. When used during flight it will start >descening/ascending but it will only show the correct digits when >AT is being engaged.>Tom, he's wanting to use a "pick list table" of altitude settings.My point was focused to the fact that, if one believes that a K:Event assignment doesn't work as expected, the best thing to do is read the related AVar to see what's going on. In this case, testing (A:AUTOPILOT ALTITUDE LOCK VAR,feet) would have shown 8000, giving the clue that the problem was related to that specific gauge (PF100) internal coding and not the (>K) assignment.Tom
  8. Hi,Where do you read the current selected altitude?I mean, which A:Variable are you using that should return 8000 ?Tom
  9. >So I'd like to place the A:Variable into the macro to save >repeating it in the code lines that move the rolling number strips.This is an example of the rolling numbers in my altimeter (757)http://forums.avsim.net/user_files/135822.jpgAnd the code is : (A:Indicated Altitude, feet) sp0 l0 int 10 @2 pow % 10 @2 1 - @1 1 - - 0 max pow / int/Macro>For the tenths thousands: @AltDigit(4,4) s1 9980 >= l1 100 % 80 - 20 / * @AltDigit(1,5) +etc..For the thousands:@AltDigit(3,3) s1 980 >=l1 100 % 80 - 20 / * @AltDigit(1,4) +For the hundreds:@AltDigit(2,2) s1 80 >=l1 80 - 20 / * @AltDigit(1,3) +And the tenths, "standard" code :-)(A:Indicated Altitude, feet) abs 100 % 10 / Notes:Each digit starts to roll at 80 % of the reference value; I gues this should be similar in most commercial altimeters. Also rolling occurs from top to bottom ie your bmp needs to have this layout:0987etc. Most altimeters I've seen (even on payware addons) roll the wrong way.Tom
  10. Ok,So you want a rolling effect after each Let me search in my bag of effects... :-)Tom
  11. >Also, you say "lg" is the logarithm base 10 of a number. I see in >the SDK, 'log' and 'ln'. Now 'ln' would be natual log to the base >e. Would 'log' and 'lg' be the same thing? Also would 'exp' >and 'pow' be the same?"Log" needs an exponent ie:"20 10 log" is the same as "20 lg" = 1.301etc"exp" raises a number to the e exponent (is NOT the same as POW)ie 1 exp = 2.7182 exp = 7.389>So I'd like to place the A:Variable into the macro to save >repeating it in the code lines that move the rolling number strips.Hold on and I'll try to give an example here.Tom
  12. Jan,If I don't miss your point, what you want is to add scrolling effects to the numbers in the autopilot MCP console?Tom
  13. Hi Nick,>>@1 sp0>@4 0 > >if{ l0 10 @4 pow * sp0 }>l0 int 10 @3 pow % 10 @3 1 - @2 1 - - 0 max pow / int>>would you be kind enough to explain the significance of the @>character, that is, what does @1, @4, etc. achieve?Sure :-)The @ character symbolizes a paramater passed to a macro, and the number to the right is the order in the sequence of the total parameters passed, each of them separated by comma.For example @1 2 * @2 + @3 +Then, calling @Macro1(10,20,30) will pass 10 to @1, 20 to @2 and 30 to @3.Now, what kind of values can receive a parameter "@" ?1) literal stack values : @Macro1(10)2) A,L,G var values : @Macro1((A:Indicated Altitude, feet)) 3) Register values : @Macro1(l0,l1,l2)4) Part of var names : @Macro1(A:Indicated Altitude) or @Macro1(feet)5) Macro names : @Macro1(@NestedMacro)6) Resultant stack values : @Macro1(5 2 *,4 3 +) will pass 10 and 77) "Popped" stack values : 20 @Macro1(10) will pass 10 to @1 AND 20 to @2 if that exists in the called This is an essential description, hope it was clear enough>Also, what does 'pow' do.>I also see in the sdk table,>lg, neg (negative ? but how used), eps. Can you possibly>explain these as well."pow" raises a number to an exponent, the same as "^"Ie 10 2 pow = 100 10 3 pow = 1000"lg" is the logarithm base 10 of a numberie10 lg = 120 lg = 1.30103 "neg" is the same as "/-/"ie 5 neg = -5 -5 neg = 5I don't know what is "eps", sorry.>@AltDigit((A:Indicated Altitude,feet) 100000 +>100000 % s0,2,0) 9 == if{ @AltDigit(l0,3,0) @AltDigit(l0,1,0)>10 / + } els{ @AltDigit(l0,3,0) }>>which scrolls a rolling number to the next value while the>preceding rolling number rolls from 9 to zero. Is it possible>to build into the macro(A:Indicated Altitude,feet)? I know>this process can be achieved with modulus, but this is a>simple way to understand the application.I'm not sure what you mean here, maybe what you want is to fix the Avar directly inside the @AltDigit macro?Tom
  14. Hi,This should work:One single click, round from 1 to 9(LVar) d 9 != * 1 + (>LVar)Tom
  15. > I use a 'c' to clear the stack at the top at the top of >>> > > c> .... >>>> blocks. However, that won't stop an infinite loop, it's>just a safeguard to clear the stack from what might remain of>previous operations.I cannot agree more with you here. I think most people are not aware of the importance of that "c" when dealing with advanced XML gauges, because there is a common idea that the stack's composition is valid for only one line of code in ,,etc tags; which is not true. Even "s" registers are shared by all of the included in a I found this not too long ago after much struggling with some of my complex macros that causes FS to hung without "visible" reason.> Also, it could be some 's0' in a macro is conflicting with>reg 0 outside the macro. Resulting in indeterminate>operations. Same goes for accidental L:Vars with the same>names. This is quite true as well.Tom
  16. Hi Robert,Some hints:> @ExtDigit((A:GENERAL>ENG ELAPSED TIME:1,seconds),1,0)/Value>Make it Maximum="9", as you're actually extracting one digit :-)And check this against the bmp layout you're using, related to the tag, with between 0 and 9.> %((A:GENERAL ENG ELAPSED TIME:1,seconds) 3600>/ d 1% 60 * r flr )%!04.0f!:%!02.0f!Replace this with %((A:GENERAL ENG ELAPSED TIME:1,hours))%!04d!:%((A:GENERAL ENG ELAPSED TIME:1,hours) 60 %)%!02d!%if you want the result in hhhh:mm format.Regards,Tom
  17. Hi,If what you want is to use two panel folders, both including the gauge referenced, which in turn needs to return 0 somewhere in one of the panels and 2 in the other, you could use any of the aircraft's string values that are taken from aircraft.cfgFor example, you can use ATC FLIGHT NUMBER:in aircraft.cfgfor panel 1:atc_flight_number=134for panel 2:atc_flight_number=any otherin your gauge2 0 (A:ATC FLIGHT NUMBER,string) '134' scmp 0 == ?(>L:Your Var,enum)When it is '134' will return 2 (panel 1) and 0 otherwiseJust another approach... Tom
  18. Hi,Would be useful for you to use AUTOCOORD_ON /OFF ??These works ok in FS2004,and if it may concern, I have a registered version of FSUIPC, though I think this is not relevant.Tom
  19. >Tom, just had a thought. Can your micro approach be modified>to extract more the one digit? For example, extract 345 from>1234567.>cheers,>nick>Tom, just had a thought. Can your micro approach be modified>to extract more the one digit? For example, extract 345 from>1234567.>cheers,>nickNickSimple as well :) with a few changespseudocode:"extract from N value, n number of digits, starting at digit n right most, including n number of decimals"Macro (raw):@1 sp0@4 0 > if{ l0 10 @4 pow * sp0 }l0 int 10 @3 pow % 10 @3 1 - @2 1 - - 0 max pow / intcalling:@ExtDig2((LVar),nCant,nStartDigit,nDecimals)Examples:for a value of 12345678.4567@ExtDig2(lVar,3,4,0) returns 567@ExtDig2(lVar,3,1,0) returns 8@ExtDig2(lVar,5,5,2) returns 67845 ; 100 / will give 678.45etc etcNOW, @ExtDig2(lVar,5,5,3) returns an erroneous value, the concept is the integer used for intermediate conversions must not exceed 10 digits; in this case that would be 12345678456 (11 digits)BUT for 12345.1234 --> @ExtDig2(lVar,5,5,3) will return 45123 ok.Hope all this was understandable and not a messy group of lines! :)Regards,TomEDIT: If you don't want to consider the decimals,@ExtDig2((LVar),nCant,nStartDigit) will work ok too.
  20. Ok JanThis is the macro: @1 sp0 @3 0 > if{ l0 10 @3 pow * sp0 } l0 int 10 @2 pow % 10 @2 1 - 0 max pow / int And the calling:@ExtDigit((ALGVar),nDigit,nDecimals)Where:(ALGVar) is the A,L or G var from where to extract the digitnDigit is the position of the digit to extract, starting from the right (honor to RPN!:-))nDecimals is the number of decimals to be included in the calcs.For instancefor a value of 123.456789999999@ExtDigit(lVar,1,0) means I want to extract the right most, discarding the decimals. It returns 3@ExtDigit(lVar,2,0) returns 2 ; @ExtDigit(lVar,3,0) returns 1 and@ExtDigit(lVar,4,0) and up returns 0using decimals:@ExtDigit(lVar,1,2) returns 5 @ExtDigit(lVar,2,2) returns 4 @ExtDigit(lVar,3,2) returns 3 @ExtDigit(lVar,4,2) returns 2 etc etc.As you can see, is a simple but powerful solution to get rid of those 100 % 10 flr,etc..when working with rolling numbers or something similar. Tom
  21. Nick,This is how it works:Value ----> Stack return (top-bottom)(Empty)---->0 (implicit)123------>123 0 100------>100 123 0 %-------->23 0 (both 123 and 100 are popped and discarded)r-------->0 23If instead you have any value on the stack before 123 is placed , r will put that value on top (ie 45 123 100 % r gives 45 on top)Hope this is clear enough to be useful to you :)BTW, I understand what you're looking for is an easy way to extract any digit from a value without the need to remember those 10000 + 100 % 10 / etc etc.? I use a very simple macro that does the work for me very good...and can post it if you're interested.Regards,Tom
  22. >123 100 % r is indeterminate on its ownHowever seems so, it is not indeterminated but equals 0>because it will return whatever was on the top of the stack before >it was executedThat is correct. BUT, an empty stack will return 0 any time you command an extraction from it, either through a (>L:Var) assignment, a calculation (ie + + ), etc.Some examples (>L:Var1,number) (>L:Var2,number) (>L:Var3,number)is the same as0 (>L:Var1,number) 0 (>L:Var2,number) 0 (>L:Var3,number)+ + - (>L:Var1,number)is the same as 0 (>L:Var1,number) / (>L:Var1,number) 0 / (>L:Var1,number)1 / (>L:Var1,number)1 0 / (>L:Var1,number)ALL are the same as 0 (>L:Var1,number). And yes, even a division by 0 gives no error but 0 !!! >>Incidentally what does XML do if the stack is empty and an>attempt is made to access the top (nonexistent) value? In>general, what does XML do in other similar error situations,>such as using non-integer values for the % operators. C/C++>would throw an exception or a complile time error. There is no error here, as noted on the lines above.TomEDIT: modulus in XML will work with integer, non integer and negativevalues without any trouble.
  23. >>123 100 % r should give 0>Are you sure? Basically, 23 is 'stripped out' and placed on>top of the stack, and the 1 is pushed down the stack, so a>stack reversal should reinstate the 1?>cheers,>nickI am sure :-)Whatever operation you do between two values placed on the stack will mean both being extracted an replaced by the result of the operation.ie 2 3 Stack=3 22 3 * Stack=65 2 3 * Stack=6 5 5 2 3 * - Stack=-12 3 * r Stack=0 65 2 3 * r Stack=5 6 etc, etc,Tom
  24. >>BTW, >Worse, still, 123 100 % will not be equal to 1!>I don't think you saw the 'r' in the line to reverse the stack>to obtain a value of 1.>cheers,>nick123 100 % r should give 0 or the value existent in the stack before 123, because both 123 and 100 values are extracted from the stack by the % operator.BTW, one form of "imitating" modulus in XML could be:123 2 % = 123 d 2 / int 2 * - Indeed seems easier to use %...Tom
  25. Ooops! thank you Bill, I always thought it was just the fractional rest. Lucky I, like seems to be Nick's case, only needed to use it for decimal moudulus so far...Your explanation was VERY helpful indeed :-)TomPD: Never is too late to learn basic things!
×
×
  • Create New...