Jump to content


* - - - - 1 votes

Placing 3rd Party Macros


  • Please log in to reply
12 replies to this topic

#1 IBtheSarge

IBtheSarge

    First Class Member

  • Moderator
  • PipPipPipPipPipPipPipPip
  • 10,718 posts
  • Location:Central Florida

Posted 18 February 2005 - 04:48 PM

This tutorial is possible through the efforts of Jeff Stanyer, who mentored me through this process via email over several weeks. He put up with a ton of bandwidth going his way asking questions that were sometimes pointless, useless, meaningless, and which often contained the answer in my description of the problem I was asking him to solve. None of this -- the tutorials, the lowered framerate impact in my sceneries, even the redesigned macros to lower the overall polygon count -- would have been possible without his vast storehouse of knowledge and his EXCEPTIONAL patience and understanding. As I posted about him in another forum, "If 'ere's a 'eaven som-'ere, e'll be th' bloke standin' roun' the rivers o' wine tellin' St Peter 'ow ta change it into BEER!!!!!!" Thanks, Jeff!   :D

1. SCASM -- you will need this program to compile your XML file into the correctly formatted .bgl scenery file for use in your scenery; get it HERE and install it in a directory that you will use to keep the 3rd party macros in and where you will generate your XML file to place those macros.

2. Copy the below code and, using Wordpad, paste the code into the new document and save it with a name that will let you readily identify what it is and why it was created:

;*********************************
; START OF CODE FOR PEASE AFB NH 2
;*********************************
Set( buf 100 )
Set( areamx 64 )
Set( linbuf 64 )
Set( ppperr 2000 )
UVar( $FSSCTEMP1 5 )

Header( 1 N43:05:43.9500 N43:03:36.0000 W070:48:24.0000 W070:50:15.9900 )

LatRange( N43:03:36.0000 N43:05:43.9500)

;ILS RUNWAY 16
Macro( F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )

;**************
; END OF CODE
;**************


Make sure you have copied-pasted the ENTIRE above code, exactly as is -- nothing left out, and nothing extra. The parts you need to change will be highlighted in red as we move through this tutorial.

3. In the same directory, put any macros you have downloaded that were created by other designers. You will need two files per macro -- the .api or .scm macro file itself, and either a .bmp or .jpg image of the macro. DO NOT USE A TEXTURE .bmp IMAGE -- you need to see a picture of the completed macro as it will appear in the scenery to make sure you are getting ready to call out the correct macro.

4. Change the header data to something that means something to you.:

;*********************************
; START OF CODE FOR
PEASE AFB NH 2
;*********************************


It's a way to double check that you're working with the correct XML file.

5. Change the location to show the location of the airport/airbase you're working on:

Header( 1 N43:05:43.9500 N43:03:36.0000 W070:48:24.0000 W070:50:15.9900 )
LatRange(
N43:03:36.0000 N43:05:43.9500)

Bottom line of lattitude; your airport/airbase is COMPLETELY above this line.

Header( 1 N43:05:43.9500 N43:03:36.0000 W070:48:24.0000 W070:50:15.9900 )
LatRange( N43:03:36.0000
N43:05:43.9500)

Top line of lattitude; your airport/airbase is COMPLETELY below this line.

Header( 1 N43:05:43.9500 N43:03:36.0000 W070:48:24.0000 W070:50:15.9900 )
LatRange( N43:03:36.0000 N43:05:43.9500)

Right line of longitude; your airport/airbase is COMPLETELY to the left of this line.

Header( 1 N43:05:43.9500 N43:03:36.0000 W070:48:24.0000 W070:50:15.9900 )
LatRange( N43:03:36.0000 N43:05:43.9500)

Left line of lattitude; your airport/airbase is COMPLETELY to the right of this line.

6. Define the complete path and name of the macro you want to install by changing the above code:

;ILS RUNWAY 16
Macro(
F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )

You must have the full path, and it should be as simple as possible (no spaces or dashes or underscores in the directory name, and try to keep the number of sub-directories in the path to a minimum -- it's easier on the program to locate the macro file and read the data). If your macro is .scm, then change the .api in the above example to read .scm.

7. Open your airport in AFCAD and collect the following information -- the lattitude and longitude where you want the CENTER of the macro to be placed, and the direction (heading) you want the macro to face. If the macro is supposed to appear above ground level, write down how many feet ABOVE THE AIRPORT the macro will appear. (If the airport elevation is 700' do not place the macro at 735' if you only want it 35' above the airport; FS9 will add whatever you put in the elevation entry to the airport elevation; if you put 735' and the airport elevation is 700', FS9 will draw your macro at 1,435' MSL (relative to mean sea level).

8. Change the lat/lon in the code to show where you want the macro to appear:

;ILS RUNWAY 16
Macro( F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )

You aren't going to get that particular version of lat/lon from AFCAD. AFCAD shows coordinates as degrees and minutes (ddd* mm.ssss'). Converting to the format you need is simple -- enter the degrees (ddd or dd), enter the digits BEFORE the decimal point as the minutes (mm). Multiply 60 by the decimal value (.ssss) and enter the seconds (ss.ssss). This defines a precise location for the center of the macro. (You can also get the coordinates from FS9 by moving to a location, selecting map mode, and reading the lat/lon on the left side of the map display. However, FS9 presents the coordinates as dd* mm', which is not precise enough for macro alignment with other scenery. Use the AFCAD coordinates and convert them with some simple arithmetic.)

9. Change the direction you want the macro to face:

;ILS RUNWAY 16
Macro( F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )

This is generally the magnetic heading (adjusted for annual magnetic variation); however, in some cases when the area the macro needs to align with isn't quite "squared away", you may be able to use the true heading (no magnetic variation). You'll have to play with this to see which one is the right way for your particular scenery.

10. Set the elevation at which you want the macro to appear:

;ILS RUNWAY 16
Macro( F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )

This entry is relative to the airport elevation. If you want the macro to appear at ground level, leave the entry at 0.0; if you want it 20' above the airport, your entry would be 20.0.

11. Save your file to the same directory in which you have placed the SCASM program. Then drag-and-drop the file over the SCASM icon; wait a few seconds and you will see a .bgl file appear in the directory with the same name as the XML file you created. Copy/move the .bgl file into the scenery directory for your airport. The next time you start FS9 and go to that airport, the macro you placed will appear exactly where you specified. If it doesn't, go back and double-check your coordinates to make sure you entered them correctly, and reopen the airport in AFCAD to make sure you copied the essential data correctly. If the .bgl file does not appear after you drag-and-drop, it means you've left something out of the code and SCASM doesn't know what to do with it. Make sure you have not accidentally removed any of the quotation marks or > or < or other symbols in the above code.

12. Copy the macro textures into the Texture folder for your airport. This is CRITICAL unless you like white boxes all over your scenery.  

13. To place additional 3rd party macros, simply keep repeating the two lines of code

ILS RUNWAY 16
Macro( F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )


(making the required changes, of course, for each placement) until you have them all listed and correctly modified for location, heading and elevation. Then drag-and-drop to compile.

NOTE: There are a couple of other segments of that line of code you may be interested in:

ILS RUNWAY 16
Macro( F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )

Scale used; you can adjust this up or down (in tenths, unless you already know the number corresponding to the exact size you want the macro adjusted to) to present the macro at the size you want it.

ILS RUNWAY 16
Macro( F:\SargeCIV3\ilss_v10.api N43:05:15.1560 W070:49:45.9178 20 0.1 160.00 0 0 0 0 10000 0.0 1 v2= 100 0 0 0 0 0 0 )

The distance from your viewpoint (aircraft) in METERS that FS9 will begin to draw the object. In this example, FS9 would start drawing the ILS transmitter when you are flying within 10,000 meters (10 km) of where the macro is located. This can be a GREAT framerate saver; can you "see" the ILS transmitter on an airport from 10 km away? No; so why would you want FS9 to start drawing it that far away and use resources that it could be using to do something else, like maintain your framerate? If you are flying TOWARDS the airport, maybe you WOULD want FS9 to start drawing it 10 km away, so it would be fully displayed when you did get close enough to see it. But how important is that? What about all those transmitters at airports you are PASSING BY? If FS9 has to draw them when you're within 10 km, it doesn't matter if you're going to that airport or not; FS9 is using resources to draw the macro even though you're never going to get close enough to see it. Setting this to 5000 is acceptable; at 5 km, if you aren't going to that airport, no problem, because you'll be past it soon and FS9 will forget about maintaining it in the display. If you ARE going to that airport, it will be displayed by the time you get there.

Edited by sarge, 18 February 2005 - 05:02 PM.


#2 Neil.

Neil.

    Hardware Guru\Screenshot Hotshot of 2005

  • Members
  • PipPipPipPipPipPipPip
  • 8,621 posts
  • Location:Wiltshire

Posted 18 February 2005 - 04:58 PM

Excellent work there Sarge :P  :D

I'm sure this will be a valuable resource :o

#3 IBtheSarge

IBtheSarge

    First Class Member

  • Moderator
  • PipPipPipPipPipPipPipPip
  • 10,718 posts
  • Location:Central Florida

Posted 18 February 2005 - 05:31 PM

leworthy, on Feb 18 2005, 05:58 PM, said:

Excellent work there Sarge :P  :D

I'm sure this will be a valuable resource :o
Thanks; posted second part (placing default FS9 Libary Objects) just a few minutes ago.  Part 3 is using XML to create an exclusion; Part 4 is using XML to create a LibraryObjects file for macros YOU create and then placing them in scenery using XML.

#4 boeing_737

boeing_737

    Airline Transport Pilot

  • Members/Edit
  • PipPipPipPipPipPip
  • 3,719 posts
  • Location:Bangalore

Posted 18 February 2005 - 09:38 PM

Brilliant piece of work there Sarge! This has got to be pinned.
Your effort clearly shows on the work you have done. :D :o

#5 IBtheSarge

IBtheSarge

    First Class Member

  • Moderator
  • PipPipPipPipPipPipPipPip
  • 10,718 posts
  • Location:Central Florida

Posted 18 February 2005 - 11:03 PM

boeing_737, on Feb 18 2005, 10:38 PM, said:

Brilliant piece of work there Sarge! This has got to be pinned.
Your effort clearly shows on the work you have done. :D :o
Hope it helps .... it's basically only an example of working code, and instructions on what to change to make it work for different types of objects.  We won't go into HOW Jeff got to me to this stage -- but I can tell you this:  he sure didn't spoon feed me.  He gave me bits to whet the appetite and make me research, read, study, and absorb everything I could so I could at least come back to him with INTELLIGENT questions (even though some of the questions I asked had very obvious answers if I had put a bit more thought into them before I asked).

Anyways, it's a starting point for anyone that wants to place scenery with XML and get rid of nearly all of the framerate hits due to the number of resources FS9 has to use to draw so many polygons for detailed scenaries.

The use of XML for exclusions, and then being able to create your own LibraryObjects file from your own macro designs and call them out with XML, will complete the process.  In addition to posting these instructions, I'm working on a tutorial package using HTML with images that can be downloaded and studied off-line.

#6 SargeJr3

SargeJr3

    Gallery Manager

  • Gallery Manager
  • PipPipPipPipPipPipPipPip
  • 10,067 posts

Posted 18 February 2005 - 11:04 PM

excellent!

#7 boeing_737

boeing_737

    Airline Transport Pilot

  • Members/Edit
  • PipPipPipPipPipPip
  • 3,719 posts
  • Location:Bangalore

Posted 19 February 2005 - 04:16 AM

Quote

In addition to posting these instructions, I'm working on a tutorial package using HTML with images that can be downloaded and studied off-line.
I'm sure looking forward to that! :o :D

#8 IBtheSarge

IBtheSarge

    First Class Member

  • Moderator
  • PipPipPipPipPipPipPipPip
  • 10,718 posts
  • Location:Central Florida

Posted 19 February 2005 - 01:22 PM

boeing_737, on Feb 19 2005, 05:16 AM, said:

Quote

In addition to posting these instructions, I'm working on a tutorial package using HTML with images that can be downloaded and studied off-line.
I'm sure looking forward to that! :o :D
A COMPLETE tutorial .... starting with modifying an AFCAD, excluding some default items, adding default FS9 LibraryObjects, adding 3rd party macros, and adding customized macros (and creating your own LibraryObjects file from those macros).

The tutorial will take you from a default airport to a customized airport by the end of the tutorial.  Haven't picked the airport yet, but I'm thinking along the lines of modifying a local airport somewhere (something that's VERY limited in type of aircraft handled) and turning it into a major airport for commercial trafic with military units co-located, maybe parallel runways, etc., etc.  Will need to find one with sufficient land available for expansion.

Will also do a walk-through on selecting AI aircraft and modifying the aircraft.cfg files for them, and using TTools to generate flightplans for AI traffic into/out of the new airport.

Becasue of the scope (it goes without saying), this tutorial isn't going to be out tonight .... it's going to be a couple of months in the making because I've got to squeeze it in between completing KPSM and KPBG and then going back and reworking my KLIZ and ME16 to the new XML process.

#9 boeing_737

boeing_737

    Airline Transport Pilot

  • Members/Edit
  • PipPipPipPipPipPip
  • 3,719 posts
  • Location:Bangalore

Posted 19 February 2005 - 09:51 PM

I'll wait. Cant wait to add my OWN airport. :D

#10 SargeJr3

SargeJr3

    Gallery Manager

  • Gallery Manager
  • PipPipPipPipPipPipPipPip
  • 10,067 posts

Posted 20 February 2005 - 05:35 PM

these are very exciting times

#11 PiP

PiP

    Cruising at FL140

  • Members
  • PipPipPipPipPipPipPipPip
  • 14,896 posts
  • Location:Windermere, GB. EGNL

Posted 24 February 2005 - 11:21 AM

Looks good.
How can I make a .api file?
does gmax export them?

#12 Derek

Derek

    Airline Transport Pilot

  • Members
  • PipPipPipPipPipPip
  • 3,210 posts
  • Location:Canada

Posted 27 February 2005 - 12:47 AM

Excellent in-depth tutorial sarge, I am sure many will find it very useful  :o  :D

#13 Cheech

Cheech

    formerly flyguy9eye

  • Members
  • PipPipPipPipPipPip
  • 2,022 posts

Posted 28 February 2005 - 01:18 AM

Derek, on Feb 27 2005, 12:47 AM, said:

Excellent in-depth tutorial sarge, I am sure many will find it very useful  :o  :D
Very very useful!