Jump to content
Sign in to follow this  
spokes2112

Programming Question XML or C

Recommended Posts

Good Day, I cannot find a clear description of the "%" operator used in C ?? and or XML gauges. Taking Modulo ????Remainder divides the last two stack entries ???Could someone give example in normal math? What would be a good purpose for its use?Thanx Roman(KGRB)Technology Vs. Ignition Timing ,,,,, So far advanced.... It's retarded. :-)


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 bartels

Modulo or remainder dicision is the same.Take for example the division of 11 by 2. In floats it is 5.5 or in integer 5 with remainder 1. So 11%2=1 or 11 mod 2 = 1. It's often handy to cut away leading digits.Arne Bartels

Share this post


Link to post
Share on other sites

Arne, Thanks as always !!! It is exactly what I was looking for, I need to extract a number of valid decimal places after the decimal point and assign a value. Doesn't work yet properly, but very close.Also, do you ( or anyone ) know where to find more information on strings and their formats to coincide with the new information provided by the panel sdk? Thanx again. Roman(KGRB)Technology Vs. Ignition Timing ,,,,, So far advanced.... It's retarded. :-)


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

Time for a bump :)I really need some help with this as well. I'm trying to 'concatenate' some information and present it in a new way, an endurance string, with 4,5 hours being presented as 4:30The calculation goes as this (hopefully correct):4,5 is put on stack by fuelamount/(flow1+flow2+0.0001) for my twin.duplicate floor duplicate store0 (4 in reg0, 4.5 and 4 on stack)modulo 60 multiply s1 (4 in reg0, 30 in reg1, stack empty)Assuming the above is correct, how do I concatenate %reg0% %:% %reg1% into a presentable string? Reading and writing string code seems pretty hard for me. I've checked the DME.xml and similar gauges, that pieces together various information into a single string, but I'm not able to spot the 'how-to-do-it'.Anyone?

Share this post


Link to post
Share on other sites

Karl,Once again not tested, but theoretically correct, I'm sure Arne may find a better way. :-)%((A:Fuel total quantity weight, pound) (A:Fuel weight per gallon, pound) / (A:Recip eng1 fuel flow, gallons per hour) (A:Recip eng2 fuel flow, gallons per hour) + / s0 abs)%!d!:%(l0 d abs - 60 *)%!d!%{end} In "english" after the calculations to get remaining time:-Store time (s0)-Take absolute value and display with colon (hours) (abs)-Load time (l0)-Duplicate Previous and take the absolute value (d abs)-Subtract the 2 to get decimal minutes (-) -Decimal minutes * 60 to get minutes and display (60 *)You could also use only the fuel remaining in the tanks currently selected. ((A:Fuel selected quantity, gallons) to replace ((A:Fuel total quantity weight, pound) (A:Fuel weight per gallon, pound) / Not sure why you used 0.0001 + ??P.S. Still haven't found any real good resources on strings, anybody?Hope this helps.Have a good day. 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

Thanks.Great help as usual. I'll dig right into it.The 0.0001 + was just to prevent division by zero, don't know how picky FS really is. I use it 'always', due previous bad code in other aspects :)Don't know if this is interresting to someone, but I made a 'check-list' type display yesterday. It's probably very basic for you guys, but maybe some other (I'm talking about me nw :)) newbie can find it useful. %((L:Checklist Number, enum))%{case}%{:0}COMPLETE%{:1}ON%{:2}CHECK%{:3}PRESSURIZE%{:4}CHECK%{:5}2275@39.5"%{:6}MAIN/AUX 90MIN%{:7}REVIEW%{:8}ENRICH%{:9}2275@39.5%{:10}OFF%{end}%Obviously you'll need a switch to 'scroll' through the items that sets the L:Checklist Number, enum. This is just one of a total of twentytwo 'items' (elements), that build a total of eleven checklists. Each checklist has nine checks to complete.One thing though. If I use small characters, letters like g, y, q, that go below the 'baseline' is somewhat cropped, but I thought the y axis offset would prevent that.Thanks.

Share this post


Link to post
Share on other sites
Guest

LOL, whups... Well, you get the picture :)

Share this post


Link to post
Share on other sites

Karl,Excellent Idea on the checklists :-)>>>One thing though. If I use small characters, letters like g, y, q, that go below the 'baseline' is somewhat cropped, but I thought the y axis offset would prevent that.If you change mulitline="No" to "Yes" That should take care of it, although you are probably are going to have to realign everything as fontweight and text width changes. I thought multiline would do what it says-- allow more than one line, doesn't seem to be the case, or am I missing something here. BTW your entry of 444 for fontweight,,, Did that work for you?I am only able to use multiples of 400 to see any results. IE 400,800,1600. 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

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