Jump to content
Sign in to follow this  
Propwash

Storing String Data

Recommended Posts

What's the best way to store string data?Building off of the (COM1 Ident, string)? thread, once gps data are retrieved, what's the best way to store the information, specifically the string info? I would like to search for more than just the nearest airport that uses a particular frequency, and return information about, say, the nearest 5 airports. Something like (searching 122.10 mhz whilst at O'Hare) AIRPORT____TYPE_____NM______BRG KDPA_______FSS______17______257 KLOT_______FSS______24______204 KARR_______FSS______29______246 -C18_______FSS______30______176 KGYY_______FSS______31______135and display the five lines of information at the same time, without deleting the previous match when the gps query finds a new one.The gps search code is not the problem; it's the display of the previous queries, and numbers are easy ... but the strings are a little different. Is there a better, perhaps more elegant way to remember the string data than the symb – ord - chr approach? (@c:WaypointAirportIdent) 0 symb ord (>L:IdentChar0,number) (@c:WaypointAirportIdent) 1 symb ord (>L:IdentChar1,number) (@c:WaypointAirportIdent) 2 symb ord (>L:IdentChar2,number) <String>%((L:IdentChar0,number) chr (L:IdentChar1,number) chr scat (L:IdentChar2,number) chr scat)%!s!</String> Many thanks, Bob

Share this post


Link to post
Share on other sites

Bob, unfortunately no. No real elegant way. BTW I updated the code a whole bunch, its in the previous topic we were at. Kinda looks like we were in the same boat.Done for today:Party: getting closer to kickoff!Roman


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

 

Share this post


Link to post
Share on other sites

I have been working with strings and remembered this old thread. I finally discovered that which many people, I'm sure, have known forever - strings can be stored, momentarily, in internal registers. So, if you can make use of store and load within one Update cycle, it works, and you may be able to avoid the repetitious use of string operators symb, ord, chr, scat and L:Vars. Bob

Share this post


Link to post
Share on other sites

Bob, Wow! This digs up an old topic (Oct./Nov 2010) where you needed to get the 5 nearest matching Comm frequencies, give type and bearing/distance. The following full code is my 9th complete retry of this little project. It is unfinished and just a hypothesis / brain teaser . The remaining "TODO" section is labeled "BUBBLE SORT BASED ON GEOCALC DISTANCE" & is commented out. That section was for when you are approaching a comm station then pass it it will resort the results before the database query finishes. A database timing result chart is below. Anyway, if you look at the Macro's named "s2d" & "d2s" you can find that I used this to store a 4 digit string into just 1 L:Var. BTW G:Vars 4-6 are missing! Where did they go? Thinking.gif LOL! They where part of a test routine to time the database for a full search. Use this as you wish, I am basically done with it as I donot remember what I did Hypnotized.gif LOL! Maybe there is something in here you can use. I just threw this into FS9 Mooney for a test, it does work except for the bubble sort. BTW the best test routine I have found is to fly around KORD (40 NM radius) w/ comm set to 118.40 & for a good sort test head to KDTW on same freq. then return. . Roman

 <Gauge Name="COMM5" Version="1.0"> <Element Name="BACKGROUND"><Rectangle Width="151" Height="128" FillColor="#b7b7b7" LineWidth="4" Color="#7f7f7f" Bright="Yes"/></Element><Element><Position X="0" Y="0"/><Circle Radius="4" FillColor="Black" Bright="Yes"/></Element><Element><Position X="143" Y="0"/><Circle Radius="4" FillColor="Black" Bright="Yes"/></Element><Element><Position X="0" Y="120"/><Circle Radius="4" FillColor="Black" Bright="Yes"/></Element><Element><Position X="143" Y="120"/><Circle Radius="4" FillColor="Black" Bright="Yes"/></Element> <!-- GENERAL OR GPS SYSYTEM MACROS --><Macro Name="c">C:fs9gps</Macro><Macro Name="com">(A:COM2 STANDBY FREQUENCY, MHZ) (A:COM1 STANDBY FREQUENCY, MHZ) (A:COM2 ACTIVE FREQUENCY, MHZ) (A:COM1 ACTIVE FREQUENCY, MHZ) 4 (L:COMMSELECT, number) case</Macro><Macro Name="reset">0 (>G:Var2) 0 (>@c:NearestAirportCurrentLine) 0 (>@c:WaypointAirportCurrentFrequency) @timer</Macro><Macro Name="nearcurr">(@c:NearestAirportCurrentLine)</Macro><Macro Name="apt_match">@ident (@c:NearestAirportCurrentIdent) s1 @sc l1 slen 0 != and</Macro><Macro Name="apt_inc">@nearcurr (@c:NearestAirportItemsNumber) 1 - > if{ (G:Var2) (>G:Var3) @reset } els{ 0 (>@c:WaypointAirportCurrentFrequency) @nearcurr ++ (>@c:NearestAirportCurrentLine) }</Macro><Macro Name="los">(A:RADIO HEIGHT, feet) 2 * sqrt 0 max 7 + near</Macro><Macro Name="ident">(@c:WaypointAirportIdent)</Macro><Macro Name="type">(@c:WaypointAirportFrequencyName)</Macro><Macro Name="lat">L:Lat@1, number</Macro><Macro Name="lon">L:Lon@1, number</Macro><Macro Name="aptlat">(@c:WaypointAirportLatitude, radians)</Macro><Macro Name="aptlon">(@c:WaypointAirportLongitude, radians)</Macro><Macro Name="gpslat">(A:GPS POSITION LAT, radians)</Macro><Macro Name="gpslon">(A:GPS POSITION LON, radians)</Macro><Macro Name="geocalc">@1 (>@c:GeoCalcLatitude2, radians) @2 (>@c:GeoCalcLongitude2, radians)</Macro><Macro Name="geodis">(@c:GeoCalcDistance, nmiles)</Macro><!-- !!! USER OPTION !!! - TO HAVE "TRUE" BEARING REMOVE "(A:GPS MAGVAR, degrees) - " --><Macro Name="geobrg">(@c:GeoCalcBearing, degrees) (A:GPS MAGVAR, degrees) - d360 near</Macro><Macro Name="fndct">(G:Var2) -- s1 (>G:Var2) l1 (G:Var3) max (>G:Var3)</Macro><Macro Name="eof">(@c:WaypointAirportCurrentFrequency) (@c:WaypointAirportFrequenciesNumber) 1 - > (@c:WaypointAirportFrequencyType) 1 > ||</Macro><Macro Name="idxmtch">@nearcurr (L:Inx, number) ==</Macro><Macro Name="timer">(G:Var4) 0 != if{ (E:ABSOLUTE TIME, minutes) (G:Var4) - (>G:Var5) } (E:ABSOLUTE TIME, minutes) (>G:Var4)</Macro><Macro Name="ap">L:ap@1, number</Macro> <!-- STRING MANIPULATOR & STORAGE MACROS --><Macro Name="s2d">0 symb ord + 100 * l1 1 symb ord + 100 * l1 2 symb ord + 100 * l1 3 symb ord +</Macro><Macro Name="d2s">@1 0.000001 * flr chr @1 0.0001 * flr @1 0.000001 * flr 100 * - chr scat @1 0.01 * flr @1 0.0001 * flr 100 * - chr scat @1 d 0.01 * flr 100 * - flr chr scat</Macro><Macro Name="sc">scmi 0 ==</Macro><Macro Name="repl">@type s1 'Approach' @sc if{ 'APPR' s1 } l1 'Unicom' @sc if{ 'UCOM' s1 } l1 'Clearance' @sc if{ 'CLRD' s1 } l1 'Ground' @sc if{ ' GND' s1 } l1 'Tower' @sc if{ ' TWR' s1 } l1 'Departure' @sc if{ ' DEP' s1 } l1 'Center' @sc if{ ' CTR' s1 } l1 'Multicom' @sc if{ 'MCOM' s1 } l1 @s2d</Macro><Macro Name="myident">L:Ident@1, number</Macro><Macro Name="mytype">L:Type@1, number</Macro><Macro Name="duptype">L:Duptype@1, number</Macro><Macro Name="adddup">' / ' scat @d2s(l1) scat</Macro>  <!-- TEAR APART THE FOUND STATION/TYPE, MODIFY TYPE, AND STORE THEM IN WORD REGISTERS, SAVE LAT/LON, SET THE CURRENT INDEX FOR DUPLICATE MATCH --><Macro Name="set">  @1 1 == if{ @ident s1 @s2d (>@myident(1)) @repl (>@mytype(1)) @aptlat (>@lat(1)) @aptlon (>@lon(1)) }@1 2 == if{ @ident s1 @s2d (>@myident(2)) @repl (>@mytype(2)) @aptlat (>@lat(2)) @aptlon (>@lon(2)) }@1 3 == if{ @ident s1 @s2d (>@myident(3)) @repl (>@mytype(3)) @aptlat (>@lat(3)) @aptlon (>@lon(3)) }@1 4 == if{ @ident s1 @s2d (>@myident(4)) @repl (>@mytype(4)) @aptlat (>@lat(4)) @aptlon (>@lon(4)) }@1 5 == if{ @ident s1 @s2d (>@myident(5)) @repl (>@mytype(5)) @aptlat (>@lat(5)) @aptlon (>@lon(5)) }@nearcurr (>L:Inx, number)</Macro> <!-- DONOT ALLOW A DUPLICATE AIRPORT TO BE LOADED IN QUEUE --><Macro Name="check">@ident s1 @s2d s1 (@myident(1)) == l1 (@myident(2)) == l1 (@myident(3)) == l1 (@myident(4)) == l1 (@myident(5)) == || || || || ! if{ @set((G:Var2)) } els{ @nearcurr (>L:Inx, number) }</Macro> <!-- IF @ NEXT LINE, TYPE FOUND & THIS IDENT = THE PREVIOUS, MODIFY TYPE, STORE DUPLICATE TYPE & DECREMENT FOUND LINE # --><Macro Name="dupl">@1 1 == if{ @check }@1 2 == if{ @idxmtch if{ @fndct @repl (>@duptype(1)) } els{ @check } }@1 3 == if{ @idxmtch if{ @fndct @repl (>@duptype(2)) } els{ @check } }@1 4 == if{ @idxmtch if{ @fndct @repl (>@duptype(3)) } els{ @check } }@1 5 == if{ @idxmtch if{ @fndct @repl (>@duptype(4)) } els{ @check } }@1 6 == if{ @idxmtch if{ @fndct @repl (>@duptype(5)) } els{ @check } }</Macro> <Update> <!-- RESET ALL ON COM CHANGE -->  @com s1 (G:Var1) != if{ l1 (>G:Var1) @reset 0 (>G:Var3) } <!-- TELL GPS SYSTEM WHERE YOU ARE --><!-- !!! OPTIMIZED !!! MAYBE..... GPS LAT/LON UPDATES MUCH SLOWER THAN PLANE LAT/LON, IT MAY GIVE RELIEF TO GPS SYSTEM, FOR THIS USE OF GPS SYSTEM IT SHOULD HAVE NO ILL EFFECTS ON HOW THIS CODE WORKS -->@gpslat (>@c:NearestAirportCurrentLatitude, radians)@gpslon (>@c:NearestAirportCurrentLongitude, radians) <!-- DYNAMICALLY SET UP DATABASE FOR NEAREST AIRPORT SEARCH -->@los (>@c:NearestAirportMaximumDistance, NMiles)@los 11 * (>@c:NearestAirportMaximumItems) <!-- IF WAYPOINT = CURRENT NEAREST, IS VALID AND FREQ. MATCHES, STORE IDENTS, CHECK FOR DUPLICATES, INCREMENT TO NEXT. --><!-- !!! USER OPTION !!! - TO TURN OFF DUPLICATE DISPLAY, CHANGE "@dupl((G:Var2))" TO "@set((G:Var2))"  AND VICE VERSA -->@apt_match (@c:WaypointAirportFrequencyValue, Mhz) @com == and if{ (G:Var2) ++ (>G:Var2) @dupl((G:Var2)) (G:Var2) (G:Var3) max (>G:Var3) } <!-- IF WAYPOINT = CURRENT NEAREST AND IS VALID, INCREMENT FREQS. UNTIL LAST, THEN INCREMENT AIRPORT --><!-- !!! OPTIMIZED !!! - DOES NOT CYCLE THROUGH NAV FREQS., ONCE THOSE ARE FOUND IT INCREMENTS AIRPORT  -->  @apt_match if{ @eof if{ @apt_inc } els{ (@c:WaypointAirportCurrentFrequency) ++ (>@c:WaypointAirportCurrentFrequency) } } <!-- IF WAYPOINT IS NOT LOADED KEEP TRYING --><!-- !!! OPTIMIZED !!! - DOES NOT LOAD AIRPORTS THAT DONOT HAVE RADIO OR NON HARD SURFACE AIRPORTS INSTEAD INCREMENTS AIRPORT  --><!-- !!! USER OPTION !!! - TO INCLUDE SOFT SURFACE AIRPORTS, REMOVE "(@c:NearestAirportCurrentAirportKind) 1 == and "  -->@apt_match ! if{ (@c:NearestAirportCurrentComFrequencyValue) 0 != (@c:NearestAirportCurrentAirportKind) 1 == and if{ (@c:NearestAirportCurrentICAO) (>@c:WaypointAirportICAO) } els{ @apt_inc } }  <!-- CONSTANT UPDATE FOR DISPLAY DRAW -->(G:Var3) s1@gpslat (>@c:GeoCalcLatitude1, radians) @gpslon (>@c:GeoCalcLongitude1, radians) <!-- CALCULATE/UPDATE DISTANCE AND BEARING, IF NONE, CLEAR STRING REGISTER, AP HEADING STORAGE AND CLEARING -->l1 0 > if{ @geocalc((L:Lat1, number),(L:Lon1, number)) @geodis s12 @geobrg s13 } els{ ' ' s12 ' ' s13 }l1 1 > if{ @geocalc((L:Lat2, number),(L:Lon2, number)) @geodis s14 @geobrg s15 } els{ ' ' s14 ' ' s15 }l1 2 > if{ @geocalc((L:Lat3, number),(L:Lon3, number)) @geodis s16 @geobrg s17 } els{ ' ' s16 ' ' s17 }l1 3 > if{ @geocalc((L:Lat4, number),(L:Lon4, number)) @geodis s18 @geobrg s19 } els{ ' ' s18 ' ' s19 }l1 4 > if{ @geocalc((L:Lat5, number),(L:Lon5, number)) @geodis s20 @geobrg s21 } els{ ' ' s20 ' ' s21 } <!-- RESET THE WORD DIGIT HOLDERS & BRG/DIST IF NOTHING AT "CURRENT" GVAR3 IS FOUND THAT MATCHES, OR @ RESET. ELSE REBUILD "IDENT" & "TYPE" INTO FULL STRINGS -->l1 5 < if{ 0 (>@myident(5)) 0 (>@mytype(5)) 0 (>@duptype(5)) ' ' s10 ' ' s11 } els{ @d2s((L:Ident5, number)) s10 @d2s((L:Type5, number)) s11 }l1 4 < if{ 0 (>@myident(4)) 0 (>@mytype(4)) 0 (>@duptype(4)) ' ' s8 ' ' s9 } els{ @d2s((L:Ident4, number)) s8 @d2s((L:Type4, number)) s9 }l1 3 < if{ 0 (>@myident(3)) 0 (>@mytype(3)) 0 (>@duptype(3)) ' ' s6 ' ' s7 } els{ @d2s((L:Ident3, number)) s6 @d2s((L:Type3, number)) s7 }l1 2 < if{ 0 (>@myident(2)) 0 (>@mytype(2)) 0 (>@duptype(2)) ' ' s4 ' ' s5 } els{ @d2s((L:Ident2, number)) s4 @d2s((L:Type2, number)) s5 }l1 0 == if{ 0 (>@myident(1)) 0 (>@mytype(1)) 0 (>@duptype(1)) ' ' s2 ' ' s3 } els{ @d2s((L:Ident1, number)) s2 @d2s((L:Type1, number)) s3 } <!-- IF DUPLICATE STATION TYPE IS FOUND ADD TO ORIGINAL "TYPE" STRING -->(@duptype(1)) s1 0 > if{ l3 @adddup s3 }(@duptype(2)) s1 0 > if{ l5 @adddup s5 }(@duptype(3)) s1 0 > if{ l7 @adddup s7 }(@duptype(4)) s1 0 > if{ l9 @adddup s9 }(@duptype(5)) s1 0 > if{ l11 @adddup s11 } <!-- BUBBLE SORT BASED ON GEOCALC DISTANCE --><!-- 		| 	IDENT   	|        TYPE    | 	DISTANCE   	|        BEARING      | 	AP STORE      |l23 l22 < if{ l2 s27 l4 s2 l27 s4 l3 s28 l5 s3 l28 s5 l12 s29 l14 s12 l29 s14 l13 s30 l15 s13 l30 s15 l32 s31 l33 s32 l31 s33 }l24 l23 < if{ l2 s27 l4 s2 l27 s4 l3 s28 l5 s3 l28 s5 l12 s29 l14 s12 l29 s14 l13 s30 l15 s13 l30 s15 l32 s31 l33 s32 l31 s33 } -- Or something like this...   l25 l24 < if{ l6 sp27 l6 s8 l27 s6 l7 sp28 l7 s9 l28 s7 l16 sp29 l16 s18 l29 s16 l17 sp30 l17 s19 l30 s17 }l26 l25 < if{ l8 sp27 l8 s10 l27 s8 l9 sp28 l19 s11 l28 s9 l18 sp29 l18 s20 l29 s18 l19 sp30 l19 s21 l30 s19 } --> <!-- SORTED AP RAW BEARING STORE -->l13 (>@ap(1)) l15 (>@ap(2)) l17 (>@ap(3)) l19 (>@ap(4)) l21 (>@ap(5)) <!-- ADD DESCRIPTORS TO DISTANCE AND BEARING AFTER SORTING -->(G:Var3) s1l1 0 > if{ l12 near ' nm' scat s12 l13 '°' scat s13 }l1 1 > if{ l14 near ' nm' scat s14 l15 '°' scat s15 }l1 2 > if{ l16 near ' nm' scat s16 l17 '°' scat s17 }l1 3 > if{ l18 near ' nm' scat s18 l19 '°' scat s19 }l1 4 > if{ l20 near ' nm' scat s20 l21 '°' scat s21 } <!-- RESET LOOPING SEARCH -->@eof (G:Var2) 5 == and (G:Var2) 6 == || if{ @reset } </Update> <Element Name="DISPLAY WITH DIAGNOSTICS"><Position X="5" Y="5"/><FormattedText X="140" Y="117" Font="Arial" FontSize="7" VerticalAdjust="Center" BackgroundColor="#575757" Color="Yellow" Bright="Yes"><String>%\{tabs=72C}%((L:COMMSELECT, number))%\{ul}%{case}%{:0}%COMM 1 ACTIVE%{:1}%COMM 2 ACTIVE%{:2}%COMM 1 STANDBY%{:3}%COMM 2 STANDBY%{end}%\{nr}%\n%\{clr=Orange}%\n%\{tabs=13L,43L,88L,115L}%\{ul}%ARPT%\t% 	TYPE 	%\t% DIST %\t%BRG%\{nr}%\n%\{tabs=9L,59C,97C,122C}%- %(l2)%!s!%\t%(l3)%!s!%\t%(l12)%!s!%\t%(l13)%!s!%\n%\{tabs=9L,59C,97C,122C}%- %(l4)%!s!%\t%(l5)%!s!%\t%(l14)%!s!%\t%(l15)%!s!%\n%\{tabs=9L,59C,97C,122C}%- %(l6)%!s!%\t%(l7)%!s!%\t%(l16)%!s!%\t%(l17)%!s!%\n%\{tabs=9L,59C,97C,122C}%- %(l8)%!s!%\t%(l9)%!s!%\t%(l18)%!s!%\t%(l19)%!s!%\n%\{tabs=9L,59C,97C,122C}%- %(l10)%!s!%\t%(l11)%!s!%\t%(l20)%!s!%\t%(l21)%!s!%\n%\{clr=Black}%\{line=140}%\n%\{tabs=8L,75L}%DB Range %((@c:NearestAirportMaximumDistance, NMiles))%!d! nm%\t%DB Max Items %((@c:NearestAirportMaximumItems))%!d!%\n%\{tabs=8L,75L}%Nearest Index %(@nearcurr)%!d!%\t%DB Total %((@c:NearestAirportItemsNumber))%!d!%\n%%\{tabs=8L,75L}%Waypoint Loaded %(@apt_match)%!d!%\t%Waypt Freq Index %((@c:WaypointAirportCurrentFrequency))%!d!%\n%\{tabs=8L,75L}%DB Time %((G:var6))%!5.2f!% min%\t%# Found (2) %((G:Var2))%!d!%</String></FormattedText></Element> <Mouse><Area Name="COMM SELECT TOGGLE" Left="52" Top="5" Width="40" Height="20"><Cursor Type="Hand"/><Click Repeat="No">(L:COMMSELECT, number) ++ s1 4 == if{ 0 (>L:COMMSELECT, number) } els{ l1 (>L:COMMSELECT, number) }</Click></Area> <Area Name="DIRECT HEADING 1" Left="118" Top="33" Width="15" Height="7"><Visible>(G:Var3) 0 ></Visible><Cursor Type="Hand"/><Click Repeat="No">(@ap(1)) (>K:HEADING_BUG_SET)</Click></Area> <Area Name="DIRECT HEADING 2" Left="118" Top="41" Width="15" Height="7"><Visible>(G:Var3) 1 ></Visible><Cursor Type="Hand"/><Click Repeat="No">(@ap(2)) (>K:HEADING_BUG_SET)</Click></Area> <Area Name="DIRECT HEADING 3" Left="118" Top="49" Width="15" Height="7"><Visible>(G:Var3) 2 ></Visible><Cursor Type="Hand"/><Click Repeat="No">(@ap(3)) (>K:HEADING_BUG_SET)</Click></Area> <Area Name="DIRECT HEADING 4" Left="118" Top="57" Width="15" Height="7"><Visible>(G:Var3) 3 ></Visible><Cursor Type="Hand"/><Click Repeat="No">(@ap(4)) (>K:HEADING_BUG_SET)</Click></Area> <Area Name="DIRECT HEADING 5" Left="118" Top="65" Width="15" Height="7"><Visible>(G:Var3) 4 ></Visible><Cursor Type="Hand"/><Click Repeat="No">(@ap(5)) (>K:HEADING_BUG_SET)</Click></Area> <Area Name="TESTING RESET" Left="0" Top="101" Width="50" Height="50"><Cursor Type="Hand"/><Click Repeat="No">(>K:RELOAD_PANELS)</Click></Area></Mouse></Gauge>

NOTES & TESTING RESULTS ETC....

 <!-- STATIC UPDATE RATE -->TESTED @ KORD, 20 FPS, MINIMAL GRAPHICS SETTINGS, CLEAR WX, NO AI, PAUSED --------------------------------------------------------------------------------------------------------------------TIME FOR FULL DB SEARCHALTITUDE | RANGE |  MAX DB | TOTAL |  W/RADIO & HARD SURFACE | W/RADIO ONLY |  W/RADIO & HARD SURFACE | W/RADIO ONLY---------------------------------------------------------------------------------------------------------------------FL400      287nm   3157      2799     		1729                  2410                  6:42       		7:34FL300      249nm   2739      2381     		1269                  1856                  5:29       		6:13FL200      204nm   2244      1770              809                  1172                  3:52       		4:2310000      144nm   1584      1045              334           		486                  2:04       		2:185000   	100nm   1100   	588              156           		198                  1:06       		1:102500        68nm    748   	310       		51                    78           		:33                :341250        41nm    451   	105       		26                    36           		:15                :17 --------------------------------------------------------------------------------------------------------------------- <!-- VARIABLE DESCRIPTIONS -->GVAR1 = COM REGISTER FOR RESETGVAR2 = # OF IDENTS MATCHED, COUNTINGGVAR3 = # OF IDENTS MATCHED, STOREDGVAR4 = DB TIME COUNTER, RUNNINGGVAR5 = DB TIME, STOREDS1 L1 = TEMP REGISTERL:IDENT# (@myident(#)) = STATION IDENT STRING (1-5), MACRO IS READ/WRITEL:TYPE#  (@mytype(#)) = STATION TYPE STRING (1-5), MACRO IS READ/WRITEL:INX  = INDEX OF PREVIOUS NEAREST ARPT FOR DUPLICATE TYPE MATCH ROUTINEL:LAT# (@lat(#)) = LATITUDE OF FOUND AIRPORT (1-5), MACRO IS READ/WRITEL:LON# (@lon(#)) = LONGITUDE OF FOUND AIRPORT (1-5), MACRO IS READ/WRITEL:AP# (@ap(#)) = RAW BEARING FOR AP DIRECT HEADING SET (1-5), MACRO IS READ/WRITEL:COMMSELECT = SELECT COMM TO SLAVE TOS2 L10 - S3 L10 EVEN = AIRPORT IDENT REGISTERSS3 L3 - S11 L11 ODD = STATION TYPE REGISTERSS12 L12 - S20 L20 EVEN = STATION DISTANCE REGISTERSS13 L13 - S21 L21 ODD = STATION BEARING REGISTERS 

AND A PANEL.CFG SECTION I USED FOR MOONEY BRAVO.

 [Window01]BACKGROUND_COLOR=2,2,2size_mm=156,400  //156,370  orig 156,308position=8visible=1ident=RADIO_STACK_PANEL gauge00=Bendix_King_Radio!Bendix-King Radio Audio, 0, 0gauge01=Bendix_King_Radio!Bendix-King Radio Nav-Comm 1, 0, 29gauge02=Bendix_King_Radio!Bendix-King Radio Nav-Comm 2, 0, 86gauge03=Bendix_King_Radio!Bendix-King Radio DME, 0, 142gauge04=Bendix_King_Radio!Bendix-King Radio Xpndr, 0, 179gauge05=Bendix_King_Radio!Bendix-King Radio AP, 0, 224gauge06=COMM PROJECT!COMM5,3,269


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

 

Share this post


Link to post
Share on other sites

Hi Roman, Hmmm. This looks great. It will take me some time to work through it, but it looks like there are some pretty interesting things in here. One question right away ... Can you explain what's going on with some of your L:Var use such as L:ap@1, number I have frequently had the need to create L variables in the form of L:Var(n) where n is determined as the code runs sort of dynamically creating L var names... if you understand what I mean... THANKS for this!! Bob

Share this post


Link to post
Share on other sites

Bob, That is kind of what I am doing, while not doing it dynamically. It is more of a case of "ease of reading". In this gauge writing/reading an L:Var depending on when it is called. - L:ap@1, number could result in (L:ap1, number), (L:ap2, number), (L:ap3, number), (L:ap4, number) or (L:ap5, number) being read or written. Also if you notice in the macro <Macro Name="ap">L:ap@1, number</Macro> there are no parentheses surrounding the variable. Doing it this way you are able to read or write to that variable during a macro call. Ex. Read - (@ap(4)) will read (L:ap4, number)Write - l21 (>@ap(5)) Register 21 is being written to (L:ap5, number) IIRC from testing, you cannot use a variable for a macro call index, but you can use the value contained in the variable. Ex. @d2s((L:Type4, number)) works but @d2s(@mytype(4)) or (Not in code) @mytype(l1) does not, I could be wrong in the last example though,, It's been a long time LOL! Going to give that one a try, it's a dreary day out :-( Will edit results here. Why in the world I named @ap, L:ap@1, number to hold the bearing value I have no idea LOL! Roman EDIT... The following didn't work for me.. :-( Bummer, cause if it did.....Oh Boy :-)

<Macro Name="Test">L:Test@1, number</Macro>  <Update>1 s14 (>@Test(l1))l1 ++ s13 (>@Test(l1))l1 ++ s12 (>@Test(l1))l1 ++ s11 (>@Test(l1))</Update> <String>%TEST1 - %((L:Test1, number))%!d!%   TEST2 - %((L:Test2, number))%!d!%   TEST3 - %((L:Test3, number))%!d!%   TEST4 - %((L:Test4, number))%!d!%</String> <!-- Nor does replacing the <Update> with this -->  <Update>1 (>L:X, number)101 (>@Test(L:X, number))(L:X, number) ++ (>L:X, number)102 (>@Test(L:X, number))(L:X, number) ++ (>L:X, number)103 (>@Test(L:X, number))(L:X, number) ++ (>L:X, number)104 (>@Test(L:X, number))(L:X, number) ++ (>L:X, number)</Update>

Edited by spokes2112

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

 

Share this post


Link to post
Share on other sites

Roman, In the For What Its Worth section - there is a "trick" way that I can think of to store a (one) string. While it is not the intended use and could trip someone up if they are working with gps NameSearch elsewhere in their gauge, this will work: 'ABCDEFG' (>C:fs9gps:NameSearchInitialName) (C:fs9gps:NameSearchInitialName) is a string and it is Read & Write capable, so it can be written and stored (not wiped clean like the internal registers each Update cycle) for further use. It can save a lot of unsightly chr scat lines of code. The NameSearch character commands (NameSearchEnterChar, NameSearchAdvanceCursor, NameSearchAdvanceCharacter etc.) cannot be used to facilitate entering NameSearchInitialName since they only work on NameSearchCurrrentName. Bob

Share this post


Link to post
Share on other sites

I have prototyped an FSX module that will store and retrieve strings for XML gauges, using the same methodology that the GPS module does. A gauge would be a better solution, but so far that has proved elusive. Doug

Share this post


Link to post
Share on other sites

My son, Robbie (BlackBox author), has written a module that allows files to be written and read (files saved to and read from disk) from xml. FS9 and FSX. It handles numbers and strings, .txt and .csv formats, and when writing files, can start at the first record, or append records onto the end of the file. Very simple syntax. It’s simple, slick, and easy to use. It’s how I recorded the flight path and altitude shown in the Google Earth view on page 157 of the GPS Guidebook (v1.1) http://www.robbiemcelrath.com/blackbox/?guide. I also use it to save and load custom flight plans and SIDS/STARS and init info like Hobbs hours. Currently, he is updating BlackBox to incorporate the file recorder dll option. BB is an even more powerful diagnostic tool with file recording capability – and it is very interesting to plot various A:Var engine or flight variables vs. time, or L:vars... whatever. You can get a ton of information if the update rate is 18 cps and you write to file every update cycle **. He will release the xml file read/write module at the same time as he releases the BlackBox3 file recorder update. Anyway, what I was getting at in the post above is storing strings in memory rather than to disk. Doug - is your module a write to file or a write to memory solution? Bob ** Writing to file consumes a minor amount of time, and the module is synchronous with the gauge, so it is possible to reach the update cycle time out limit if too many variables are being written each update cycle. Having said that, in the gauge I use for testing, I can write about 740 separate variables to hard disk file every update cycle without running out of time. Even in a complex gauge, it can still write several hundred variables to file every update cycle. It can read several thousand records from file each update cycle without running out of time. So, I don’t think there really is a practical limit to its read/write capability.

Share this post


Link to post
Share on other sites

Bob, Bringing back this thread has got me back up and running :-) Anyhow from some past posts here & fs designer along with some VB.net coding ideas the brain has been reeling. Been working on a set of "hopefully" easy to use macros to store strings up to 6 digits ( good enough for FMC & other functions ) at a time. After hours of testing 6 digits is the max a L:Var can hold reliably. ( 32 bits ) Yours & Robbie's work is great! Cannot wait for what's in store. Ditto to Doug, a XML string --> Memory module sounds like a treat! Roman


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

 

Share this post


Link to post
Share on other sites
After hours of testing 6 digits is the max a L:Var can hold reliably. ( 32 bits )
Roman, Yeah, that is what I found, too!! So, two L:Vars can hold an ICAO. Perfect for an FMS. Sounds like your macros create the two L:Vars and also convert them back to strings. Good stuff. I always like to study your xml code. You are far more advanced than me, so I learn a lot from you. I wonder, if the coding is done very carefully, how often can you get away with storing strings in the internal registers? Probably before long, I am sure, one runs into the problem that you will need to remember strings for more than one update cycle which is why if Doug has a string --> memory module, that is extremely useful. Like having S:Vars (String vars)! Bob

Share this post


Link to post
Share on other sites

Seems we're not allowed to post attachments other than images. So...If you want to give this module a try, drop me a PM with your e-mail address and I'll ship it off to you. Doug

Share this post


Link to post
Share on other sites

Doug, So the fsx_string_storage.dll in the Modules folder? The following code in one of my xml gauges? <Launch.Addon> <Name>FSX_STRINGS</Name> <Disabled>False</Disabled> <Path>fsx_string_storage.dll</Path></Launch.Addon>(A:ATC TYPE, string) (>C:FSX_STRINGS:String00)<String>%((C:FSX_STRINGS:String00))%!s!</String> Jan

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