Jump to content

taguilo

Members
  • Content Count

    883
  • Donations

    $0.00 
  • Joined

  • Last visited

Everything posted by taguilo

  1. Bill, That formula , what I call "Sun Elevation Factor", was one of the first things I've learnt from here. And indeed works great in XML so far I tested (and after a slightly change made by myself).Tom
  2. Yes, indeed I use alpha masks in some of my gauge (ie Stdby Attitude), however I couldn'd get fair results with small bitmaps (switches).I'm gettin axious waiting for FSX arrival.. :-(Tom
  3. >I was hoping to use Case structures to decide what code to use>after the Case structure determined the situation... but if it>can only apply to bitmaps, that appears to be a serious>limitiation. It's a shame that we can't put logic there or,>apparently, even a nested Element within the Case that would>handle the logic within the nested Element.>In fact what IS logic it that we can't put extra (stack) code inside a .AFAIK, those structures surrounded by "<>" (like ) are nothing but pointers to certain areas of memory in the assembled codeStrictly speaking of , when the code is compiled, each Case value is associated with a memory location where its corresponding bitmap resides. So, when a stack value is extracted with a command, it is compared against the array of defined pointers (Case's) and the matched pointer will redirect the code to the memory area that contains the bitmap to be displayed.Within this logic, I guess there is no room for other type of code.Tom
  4. Do you mean something like this?http://forums.avsim.net/user_files/145769.jpgI guess I can't reinvent the wheel here...Same as you, two bitmaps for the switch.Now, if only Transparency tag would work for Circle command....Tom
  5. >How on earth do you know the things you know? ROFLThese are the steps that worked for me:1) Analyze MS's basic XML gauges 1) Discover this forum2) Digest the pinned threads3) Read Arne's and Nick's tutorials and MS SDK3) Do basic programming4) Search the forum looking for advanced programming hints.5) Learn from advanced solutions posted - there are very talented people here.6) Start your own tests for complex situations.7) Feedback the forum with what you've learnt to help other people choose the best solutions, like they helped you choosing your own's. >Is there a way to assign a default set of attributes so that will be treated as if it has all the attributes of the >longer version aboveUnfortunately no.Tom
  6. >The use of macros is less CPU intensive. No way. There is no advantage in terms of assembled code efficiency with the use of macros. The only benefited is the programmer that has to write less lines (and an improvement of readability too IMO), but that's all.>The more code you can put into a macro, the better.Most of times this is true. But because of the reasons stated above.>Also, using Select/ Case is not very CPU intensive. This>presumably is less intensive than a load of Visible>statements.We'd have to separate this in two parts:Code is what we know the most common way of managing pure code within a stack's area. When used to support logic only, is not needed because there is no bitmap to show.Typical example would beMake the hydraulics workI would assume like you that there is not much CPU cost here.Now, when there is a need to show bitmap(s), enters in action.And for sure in this case there will be a hit in performance, because bitmaps' display consumes a lot of CPU (and FPS) power.>Ref an example above, I can't think at this time of the>morning where you would use if/els for displaying multiple>bitmaps. Obviously this can be used in Select/ Case, but I'm>thinking the way the question was put, it was being used>another way.As I posted on this same thread earlier, if/els are components of the stack, and they only "push" values that can be tested by statements.Tom
  7. >>Tom, I see many ways to set numeric values into variables>(many types) but are there no string types at all for>variables? I find it very odd that I can't find any mention of>it anywhere.>Unfortunately there is no way to save strings into LVars. Hope that MS would be kind enough to fix this for FSX.However, within a gauge's visibility, you can save strings to registers for use in different parts of the gauge.For example (stack) 'My String' sp30 ...%( l30 )%!s! Tom
  8. Scott,>1) Can we emulate a switch statement with Select / Case within the >click code or are we chained to IF's? (with / ) is a component of the structure. It cannot be used within structures. >Is a Select with 10 Cases less CPU intensive than ten linear IF / >ELS statements?Both are different things. is used only to display bitmaps, and doesn't support anything else, where if/els are conditional operators to be used within the stack's space.Tom
  9. >Question.>If a lot of complex button code is put into a macro, it would>be processed during each gauge cycle. No, code iniside a struct is not executed directly but parsed in replace of the calling reference (@macro) To make it more clear:This is what we users write to save lot of typing:value1 value2 operator1 value3value4 value5 operator2 value6cond1 if{ @MyMacro1 }cond2 if{ @MyMacro2 }cond3 if{ @MyMacro1 }An this is what is translated to assembled code:cond1 if{ value1 value2 operator1 value3 }cond2 if{ value4 value5 operator2 value6 }cond3 if{ value1 value2 operator1 value3 }Remember what I use to phrase ...Literal replacement of text...:-)Tom
  10. Scott,In the first example, "Tested False" is shown briefly and "Tested True" is then printed and keeps on showing.This happens because GVar1 is 0 at first pass of the code, making (G:Var1) 0 == equals 1 (true) and the string visible. On the other hand, in the second element (G:Var1) 1 == returns 0 (false) then teh string will NOT be visible. In the last element, GVar is changed to 1 and the consequence is the condition of each string is inverted.In the second example, "Tested False" is hidden fron init, because GVar1 is set to 1 before."Tested True" is printed always.So far tested. I don't know what you mean when you say "failed" , is that none of the strings is displayed?Tom
  11. Jan's fmc macro code is a great example of a complex logic within a simple .I for one prefer to use macros in a more referenced way.Following Jan's example, condition if{subcode1 } condition if{ subcode2 }etc@Macro1 If only one macro is called, it would be the same to put the entire code with its subcodes inside the On the other hand, I find easier to identify what does each subcdode do by using this syntax:codecodeetccondition if{ @Subcode1 }condition if{ @Subcode2 }etcI guess another point of view does always good :-)Tom
  12. Scott,Maybe you could copy and paste the code (as to avoid typos) and I might give it a test.Regards,Tom
  13. Nick,I see only two posibilities here:n1submenu1n2submenu2n3submenu3etc.This for only one button, and nX is a conditional. Each area handles a submenu (as you call it)Or:1(not relevant)n1 If(submenu1) n2 If(submenu2) n3 If(submenu3) etc.I'd rather choose the second option, could be easier to manage using macros. And as I remember, it is the way used in the default GPS500.Tom
  14. Will,This should work : (G:Var1,bool) (A:LIGHT PANEL, bool) 2 * + (ImagesSizes are not really necessary in FS2004)Tom
  15. Scott,You might try this:(remove this line! <?xml version="1.0" encoding="UTF-8"?> ) 1 (>G:Var1) (G:Var1)%('Hello World')%!s!Tom
  16. To increase - Right template: (L:dummy, enum) ++ "highest value" min (>L:dummy, enum)(Bill please stop playing with Gmax and posting on forums at the same time! :-lol )Tom
  17. Scott,>One thing I ran into was Jon's (Varmint007) tutorial on>macros. In it, he states:>>"One can also use another function as an argument.">>I almost fell out of my chair when I read this. If this is>possible, there should also be a way to trigger a macro>conditionally, depending on the result of an IF or > structure.>If you'd take the time to investigate, in these threads you'll find examples of macros:Easy macro(s):http://forums.avsim.net/dcboard.php?az=sho...ing_type=searchIntermediate macro(s) http://forums.avsim.net/dcboard.php?az=sho...ing_type=searchAdvanced macro(s)http://forums.avsim.net/dcboard.php?az=sho...ing_type=searchNow, this is important and I can't emphazise it more:Macros are NOT functions but code snippets, the same as literal replacements of text (that's why they are called "macros" :-)) Despite its common use may lead to think they are like functions, once you start to deal with some complex ones you will notice that they don't support most of the very important characteristics of functions. Ie their code cannot be isolated from the calling code, they cannot deal with any kind of "Local" vars, and they cannot help to make the final assembled code smaller.In those advanced cases, a careful analysis of the stack composition should be done to avoid wrong results because of hidden values left on the stack, overwritten registers, (s0/l0), and so many other complexities.Tom
  18. Scott,I'll try to clarify a bit:- "single vs. double parens" in Actually this is the real meaning: %( whatever )%etcetc tells the compiler that what is between parens is a stack area, where any kind of operations can be made; like in ...stack...If you use a LVar - which must be written (L:Var,unit) - inside that structure, there is no real "double parens" but instead the LVar's own parens are added to the syntax - %((L:Var,unit))% More examples: %((L:MyVar,number) 5 +)% shows MyVar value plus 5%(12 12 -)% shows 0And spaces dont't count providing there is at least one between each stack element. Open and close parens %( )% are NOT considered part of the stack in this case, due to the special treatment command has inside FS XML, but beware they are needed in other situations-more later.For example, %( (L:MyVar,number) 5 + )% is perfectly valid- Your questions:""Is there a standards guide ANYWHERE?"" Appart from Arne and Nick's wonderful tutorials, I think there is not. But if you do a search through this forum, you'll see most of your doubts have been discussed before.""Coding examples could look like (spaces shown with a '*' ):""The compiler distinguish stack's components (values and operators) when they are separated by AT LEAST one space. This includes the conditional if{ / els{ and the closing } Local vars (L:Var,unit) follow this rule: the compiler understands a stack position contains an LVar when the unit is followed by a parenthesis WITHOUT SPACES, and includes an open parenthesis, a L: sign and a comma.So this would be recognized as valid ( L:MyVar,unit) (L:MyVar, unit) ( L:MyVar, unit)And this won't (L:MyVar,unit )""Also, rules regarding macros? How about the differences between if statement syntax in values, text colors and strings? Or things that will cause a Select/Case tree to self-destruct? The scopes of s0 / l0, G:Vars and L:Vars were nicely covered by Arne... but what's the scope of a macro? Does anyone even know? I know that I can't answer ANY of the above questions... and I've read every tute I can find, plus the Panels and Gauges SDK""As I stated above, all this stuff have been already treated here, and I'm sure you'll find your answers if you do an advanced search covering those specific points you're interested in.""There is so much we could do with XML... but we're spending 80-90% of our time fighting syntax issues and problems that have become known as "just one of those things" because so very few people know the rules. The rest of us are wasting tremendous amounts of time trying to figure out how to make the tool (XML) work properly rather than using that XML tool to create awesome stuff for FS9.""Indeed there is much to do...even the most complex aircraft systems' logic can be simulated in XML. But it requires a good understanding of its basic principles and functioning, what means nothing but TIME, TEST and TEST and TEST... The gap in XML knowledge between you and me exists only because I started testing BEFORE than you. Got the idea? :-)Regards,Tom
  19. Hello Vorlin,First of all, ((L:MyVar1,bool) d 0 == ?) is dangerous to use because it lacks of one more value to compare properly. It happens in this case that it will always return MyVar1 value, but things would be different if there is a hidden stack value carried over from former code. Indeed, better is to use %((L:MyVar1,bool))%!5d!as Jan recommended.Other thing,""As you know, it's just not possible to have the text elements and the value manipulations in one element all the time.""Again, you have to be carefull when using and commands within the same , because, no matter the order it is positioned on, will execute always AFTER the part, and it could lead to wrong values especially when working with the same LVar in both commands.For example:1 (>L:MyVar,enum) (L:MyVar,enum) ++ (>L:MyVar,enum)%('Hello' 'Goodbye' (L:MyVar,enum) 1 == ?)%!s!'Goodbye' will never show because (L:MyVar,enum) ++ (>L:MyVar,enum) is being executed AFTER the command and reset again to 1 in the first element.All this said, your example #3 should work fine. Did you check whether the gauge loads ok inside Internet Explorer?Tom
  20. Peter,""It has also improved my knowledge of the use of d - existingdocumentation that I found didn't indicate that it pulls thevalue off the stack and makes it available for furtheroperations. (I am assuming that's what it does)""Actually what d does is duplicate the last value on the stack.""I don't understand though, why (L:RightMag,bool) 2 * (L:LeftMag,bool) + (>L:MagnetoStatus,enum), whilest putting the calculated value into L:MagnetoStatus correctly doesn'tfulfil the criteria for the statements.""Did you check whether those bitmaps are really present in the gauge's .cab or folder in use by the panel?Tom
  21. Paul,That is a piece of code I will probably use in my own VOR autotuning system :-)Thank you!Tom
  22. Hi,This should work:(L:RightMag,bool) 2 * (L:LeftMag,bool) + d (>L:MagnetoStatus,enum)Also there is no need to use Minimum and Maximum flags because you are controlling the range by code.Tom
  23. Paul,""3 sp0 :0 l0 d (>@c:NearestVorRemoveVorType) ++ s0 6 <= if{ g0 } gauge won't work"" Did you try first 4 (>@c:NearestVorRemoveVorType)5 (>@c:NearestVorRemoveVorType)6 (>@c:NearestVorRemoveVorType)to see whether 4 to 6 types are indeed removed? ""Other commands availibleNearestVorCurrentFilter, NearestVorSetDefaultFilter. do you know what these do?""I don't, sorry. Never tried these ones.Tom
  24. Hi,3 >= (>@c:NearestVorRemoveVorType) Is this a literal assignment?If so, then the result of whatever you are comparing against 3 value is either 0 or 1, and that is what you are actually assigning to the macro.Tom EDIT: maybe this works:3 sp0 :0 l0 d (>@c:NearestVorRemoveVorType) ++ s0 6 <= if{ g0 }
  25. Hi,You need to use a Local Var to control the increment.Something like this:*VS UP*(L:AP Vertical Speed,feet per minute) 50 + 6000 mind (>L:AP Vertical Speed,feet per minute)(>K:AP_VS_VAR_SET_ENGLISH)*VS DOWN*(L:AP Vertical Speed,feet per minute) 50 - -6000 maxd (>L:AP Vertical Speed,feet per minute)(>K:AP_VS_VAR_SET_ENGLISH)And in the MCP use(L:AP Vertical Speed,feet per minute)to read VS valueHope this helpsTom
×
×
  • Create New...