Jump to content
Sign in to follow this  
Guest greenco

XML Code Help

Recommended Posts

Guest greenco

I am trying to figure out the purpose of the percent signs, that are part of the Visable and String functions. I am not sure if it is there to cause the value to be displayed or if it is there to perform a math calculation. The following examples show many different uses of it.%(A:Electrical main bus voltage, volts)%!5.1f!(P:Local Time, seconds) 1.5 % int 1 ==%((A:FUEL TOTAL QUANTITY WEIGHT, pounds) flr s0) %(l0)%!05d!%%((A:Nav2 dme, nmiles) (A:GroundVelocity,knots) / 3600 * s1)%( l1 3600 / int s3)%( l3 3600 *s9 l1 l9 - s2)%(l2 60 / int s4)%(l3 3600 * s9 l4 60 * s8 l1l9 - l8 -s5)%(l3)%!02d!%:%(l4)%!02d!%:%(l5)%!02d!Thanksgreenco

Share this post


Link to post
Share on other sites

If it is not in a it performs a math calculation --- "Get the remainder from division". In a it serves as a "separator" between string functions/calculations as long it is not between parentheses. Inside of parentheses and also in a string it does the math calculations.Regards,Roman(KGRB)


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest greenco

I should have left this subject alone!!!Now I am more confused than ever. Would you expand on what you have told me?****************************************************************In this statement what is the percent sign doing? I understand that it is doing something to the "seconds" of the local time and it is doing it with a value of 1.5 . The "int" removes the digits after a decimal and the "==" gives a 1 (True) if the last two entries are equal. So what action does the percent sign play in this code?(P:Local Time, seconds) 1.5 % int 1 ==Is it saying to display the seconds (make visible), if "1" (the result of 1.5 "int" ) is divided by 1 and the remainder is 1?*****************************************************************In this statement is it saying the value between the two percent signs should be displayed in the format that is between the " ! " marks (5 places left of the decimal and 1 place right of the decimal).%(A:Electrical main bus voltage, volts)%!5.1f!Are there other characters that are used in numerical formats other than an " ! " mark?******************************************************************In this statement which percent signs are used as separators and which are used in calculations?%((A:FUEL TOTAL QUANTITY WEIGHT, pounds) flr s0) %(l0)%!05d!% " flr " stores the smallest interger (pounds fuel) into a stack variable called s0 for later use.The rest of this statement does not make any sense to me except the " !05d! and that formats the displayed numbers.******************************************************************In this statement which percent signs are used as separators and which are used in calculations?%((A:Nav2 dme, nmiles) (A:GroundVelocity,knots) / 3600 * s1)%( l1 3600 / int s3)%( l3 3600 *s9 l1 l9 - s2)%(l2 60 / int s4)%(l3 3600 * s9 l4 60 * s8 l1l9 - l8 -s5)%(l3)%!02d!%:%(l4)%!02d!%:%(l5)%!02d!The formula that launches a man to the moon would probably be easier to understand than this. *******************************************************************Any help will be greatly appreciated.greenco

Share this post


Link to post
Share on other sites
Guest bartels

>(P:Local Time, seconds) 1.5 % int 1 ==>>Is it saying to display the seconds (make visible), if "1">(the result of 1.5 "int" ) is divided by 1 and the remainder>is 1?>Not sure what you meant here. "1.5 %" makes the remainder division by 1.5, so the result is always a number between 0 and 1.5. Then "int" cuts away the digits, so the result is repeatedly 1 second 0, 0.5 seconds 1 . The "1 ==" is not strictly necessary I think.>%(A:Electrical main bus voltage,>volts)%!5.1f!>>Are there other characters that are used in numerical formats>other than an " ! " mark?The format is inside the "! !" as you already noted. It is very similar to normal C/C++ formats, but not all C/C++ formats work >******************************************************************>>In this statement which percent signs are used as separators>and which are used in calculations?All following "%"'s are text separators.>>%((A:FUEL TOTAL QUANTITY WEIGHT, pounds) flr s0)>%(l0)%!05d!% >>" flr " stores the smallest interger (pounds fuel) into a>stack variable called s0 for later use.>The rest of this statement does not make any sense to me>except the " !05d! and that formats the displayed numbers.s0 stores, l0 loads a number to temporary storage "0". Not really necessary in this case%((A:FUEL TOTAL QUANTITY WEIGHT, pounds) flr )%!05d!% would do the same job, or even omitting the "flr", "!05d!" rounds to integer anyway.>%((A:Nav2 dme, nmiles) (A:Ground>Velocity,knots) / 3600 * s1)%( l1 3600 / int s3)%( l3 3600 *>s9 l1 l9 - s2)%(l2 60 / int s4)%(l3 3600 * s9 l4 60 * s8 l1>l9 - l8 ->s5)%(l3)%!02d!%:%(l4)%!02d!%:%(l5)%!02d!>>The formula that launches a man to the moon would probably be>easier to understand than this. A bit complex admittedly, but all "%"'s are separators here, you should try something simpler to get the hang of it.Arne Bartels

Share this post


Link to post
Share on other sites
Guest greenco

Thanks ArneIt would help to know how the percent signs are paired up, as separators. Do they pair up in sequence? %((A:FUEL TOTAL QUANTITY WEIGHT, pounds)flr s0) >%(l0)%!05d!% IE: Is the first one, that is just to the right of the "" paired up with the one that is just before the "", at the end of the code? Or is it paired up with the second one that is to the right of "flr s0 >". If so then the third one, just after the "(10)", must be paired with the last one. I am trying to understand this XML coding and how it is put together. I used the above samples, only to show how complex it can become. Once I understand how the pairings are made, I can then experiment with making things work. greenco

Share this post


Link to post
Share on other sites

I'll try to break it down for you and give a correct version.%((A:FUEL TOTAL QUANTITY WEIGHT, pounds)flr s0) >%(l0)%!05d!%% -------------- Start of string( ----- get a non string variable/expression (A:FUEL TOTAL QUANTITY WEIGHT, pounds) -- Variable from FSflr --------------- " Floor " get the next smallest integers0 -------------- Store in pointer zero) --------------- place total expression on top of stack > -------- acts as "greater than" but in this case an ERROR% -------- separator( ------- get a non string variable/expression l0 ------- load the pointer zero ) ------- place total expression/value on top of stack% -------- separator!05d! ---------- print code... 5 digits,preceding zero,integer% -------- separator,, end of string"%" separators donot have to be paired like parentheses, they just separate individual instructions of a string. Notice the value from the expression for "quantity,weight floor" is placed on the top of stack twice. First by the expression and second from the S0 pointer.The ERROR of the ">" is caused by the fact that it residing inside the string format and not inside of closed ( ) parentheses.So with those two facts above you could rewrite the string as and get the same result. %((A:FUEL TOTAL QUANTITY WEIGHT, pounds) flr)%!05d!%BREAKDOWN% -------------- Start of string( ----- get a non string variable/expression (A:FUEL TOTAL QUANTITY WEIGHT, pounds) -- Variable from FSflr --------------- " Floor " get the next smallest integer) --------------- place total expression on top of stack % -------- separator!05d! ---------- print code... 5 digits,preceding zero,integer top of stack% -------- separator,, end of string Well I hope this helps, I am sure Arne may be able to provide a better description if any of this is still unclear or an inacurate. It's just the way I understand it.. Again hope it helps.Regards,Roman(KGRB)


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest greenco

Thanks RomanThat is exactly what I was wanting. I have it copied and placed in my XML files folder.I read "(l0)" as the number ten, when in fact it is a lower case L and a number 0. It seems like "s0" stores the value and that "l0" reads it, so it can be used.If I read your info correctly, the ")" after "flr", actually causes the next smaller integer, of the fuel weight, to be placed on the stack. So if the fuel weighed 6000.5 pounds, the number that was put on the stack would be 6000. Is this correct?greenco

Share this post


Link to post
Share on other sites

6000 yes but it should look like 06000 because of the preceding zero in the print code !05d! = 5 digits with preceding zero rounded as integer (d). So with that fact also you could also remove the FLR command. Forgot all about that.%((A:FUEL TOTAL QUANTITY WEIGHT, pounds))%!05d!% For very good information about print codes and other XML stuff find the file XMLgau01.zip by Arne Bartels at Flightsim.comGlad to be of some help Regards,Roman(KGRB)


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest greenco

Thanks again RomanYes, I already have Arne's file and I refer to it all the time. Your explaination of the string format, has made the picture a lot clearer. I still see a lot of items, in code samples, that do not make sense nor do I have any idea where they come from. I will keep digging and maybe someday it will all make sense. GRINThanksgreenco

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