Hood Exporter

The Hood Exporter is an application to extract lot, family and sim data from the neighbourhood .package files as XML and JPG/PNG images.


Before using Hood Exporter it is necessary to tell it where to find the objects.package file for the latest expansion you have installed. From the "File" menu, select "Configuration..." and either enter or browse to the install location (where the CSBin, TSBin and TSData sub-directories are located) - for UC this will end "Fun with Pets\SP9"


To export a 'hood, from the File menu, select "Neighbourhood Path..." (or type "Ctrl+N") and browse to find the required package file. If this 'hood has been exported recently, it can quickly be re-opened from the "File", "Recent Neighbourhoods" sub-menu.

From the File menu, select "Save Path..." (or type "Ctrl+S") and browse to find the required sub-directory to export the xml and images to. This cannot be the 'hood folder or a sub-folder.

To generate the XML and image files, click the "EXPORT" button (or type "Alt+E").


XML Output

I am assuming that anyone using this utilty has a working knowledge of XML and a way of processing it into a format suitable for their purpose - XSLT, JDOM, LINQ, etc

Data from the following DBPF resources are exported

  • Always: IDNO, CTSS, STR# and NGBH (not sim, family or lot tokens)
  • If Lots are selected: LTXT, BNFO and lot tokens from NGBH
  • If Families are selected: FAMI, FAMT and family tokens from NGBH
  • If Sims are selected: SDSC, SDNA, SREL, SWAF and sim tokens from NGBH
  • Images: Depending on the selection for Lot, Family and Sim images in the format selected

To find all LOTS in the 'hood, iterate all the <ltxt> elements

  • name and description child elements give the associated strings
  • if lot images were exported, the associated lot image will be ...\Lots\{@lotId}.{format}
  • to find the family living in the lot (if any) match a <fami> lotId attribute to the <ltxt>'s lotId attribute
  • the type attribute can be used to determine lot type - Community, Residential, ApartmentBase, ApartmentSublot, Dorm, SecretSociety, Hotel, VacationHidden, HobbyHidden, WitchesHidden, etc
  • if a lot is an ApartmentBase, it's sub-lots can be found from the list of <apartment> child elements by matching the apartmentId attribute to a <ltxt> element's lotId attribute. The familyId attribute of the <apartment> element can be used to find the associated family by matching a <fami> element's familyId attribute.
  • if a lot is a business, it's <bnfo> element can be found by matching the lotIds of the <bnfo> and <ltxt> elements.
  • to find the tokens (lot inventory) for the lot, find the <tokens> element with the corresponding lotId attribute

To find all FAMILIES in the 'hood, iterate all the <fami> elements

  • the family name can be found by matching the <fami>'s familyId attribute to a <str> element's instanceId attribute
  • the family home can be found by matching the <fami>'s lotId attribute to a <ltxt> element's lotId attribute
  • if family images were exported, the associated family image will be ...\Families\{@familyId}.{format}
  • all the Sims in the family can be found from the list of <sim> child elements by matching the simGuid attribute to a corresponding simGuid attribute in a element
  • to find the tokens (family inventory) for the family, find the <tokens> element with the corresponding familyId attribute

To find all SIMS in the 'hood, iterate all the <sdsc> elements WITH a characterFile attribute

  • (<sdsc> elements WITHOUT a characterFile attribute are NPCs such as the Hula Zombies, Santa Clause, Grim Reaper, etc)
  • the Sim's name can be found from the <givenName> and <familyName> child elements
  • if sim images were exported, the associated sim image will be ...\Sims\{@simGuid}_{base@lifestage}.{format}
  • the Sim's associated family can be found by matching the familyId attribute to a <fami> element's familyId attribute
  • the Sim's family ties can be found by matching the simId attribute to a <famt/sim> element's simId attribute
  • the Sim's DNA can be found by matching the simId attribute to a <sdna> element's simId attribute
  • the Sim's wants and fears can be found by matching the simId attribute to a <swaf> element's simId attribute
  • relationships to other sims can be found from the list of <srel> elements with a matching simId attribute (this is better than using the <relationship> child elements)
  • to find the tokens (sim inventory) for the Sim, find the <tokens> element with the corresponding simId attribute

Output Menu

Use this menu to select what data is included in the XML - Lots, Families and/or Sims - and if the XML is generated with extra line breaks (pretty printed).


Images Menu

Use this menu to select which image are extracted for the 'hood - Lots, Families and/or Sims - and the format of the images - PNG or JPG.


Language Menu

Use this menu to select what language is included in the XML, if a string is not available for the selected language, the default "English (US)" will be extracted.

Note: It is possible to reduce the entries in this menu by editing the "Resources\XML\languages.xml" file within the application folder. Any such edits will however be 'forgotten' when the application is upgraded.


Transform Menu

Use this menu to select a transform to apply to the XML after it is generated but before it is saved. If a transform is selected, its name appears in the application title area.

Note: To remove items from this menu delete the corresponding file from the "Resources\XSL" subdirectory within the application folder. Any such deletions will however be restored when the application is upgraded.

Note: Unlike other menus, any transform selected is NOT remembered as the application exits so you will have to reselect the transform every time the application is started - this is intentional and reduces the chance of a misbehaving transform being accidentally executed. If you want a transform to "stick" (not recommended), see the Custom Transforms section below.


Rufio Style Ouput

By using one of the two standard transforms, it is possible to generate rufio'esque output. Applying the "rufio.xsl" transform results in the nearest match to rufio output from SimPe, while the "rufioPlus.xsl" transform includes additional columns for Lots and Sims.

Using either of the rufio transforms changes the behaviour of Hood Exporter as follows.

  • Output is no longer written to a "hoodcode" (eg E001) sub-directory, but to a "Rufio" sub-directory
  • The main "hoodcode.xml" (eg E001.xml) file is no longer generated
  • "ExportedLots.txt" and "ExportedSims.txt" files are generated
  • Images are written to "LotImage", "FamilyImage" and "SimImage" sub-directories

The minor differences between Hood Exporter's rufio format and the SimPe one are as follows.

  • Exports all hood and subhood data and images together
  • All Sims extracted (including unknowns)
  • BodyType always output as an int (and not a mix of ints and strings - rufioPlus.xsl outputs an additional BodyForm column)
  • Exports true PNG images (and not JPEG format with a .png extension)
  • Option of PNG or JPEG image formats, from the Image menu
  • Option of which images (Lots, Families and Sims) to extract, from the Image menu
  • NPC sim images not extracted (these will never change, use the ones generated by SimPe rufio)
  • Extraction of additional life stage images for Sims

Custom Transforms

I am assuming that anyone contemplating writing a custom transform has a working knowledge of XSL and a way of testing it from the command line.

Hood Exporter uses Saxon HE 10.6 for xslt processing, and supports the XSLT 3.0 spec.

To add a transform, place it in the "Resources\XSL" subdirectory within the application folder, sub-folders are not supported. An example transform is provided in the "Resources\XSL\Examples" subdirectory. If starting with this file I suggest you copy it to the parent directory and rename it, that is, leave the original unaltered.

The xsl:result-document element is supported, but the output will always be relative to the user selected save location. If all output is generated via one or more xsl:result-document elements, the transform does not have to generate any other output nodes, in which case the main "hoodcode.xml" file will not be written.

There are several custom functions available in the sims2tools namespace, see the sample.xsl file for more details.

It is possible to change the default transform from "None" to one of the transform files by editing the "HoodExporter.exe.config" file in the main application directory and changing the value for the "DefaultXslt" setting from "None" to the (case-sensitive) file name of the transform, eg, "rufioPlus.xsl". It should be noted, that any edits to this file will however be overwritten when the application is upgraded.


Custom NPC Names

Hood Exporter uses a list of well-known NPC names to avoid having to open the (large) objects.package file everytime. These are held in the "Resources\XML\npcs.xml" file within the application folder and can be edited to add your own names, for example, for other Plantsim's and Pollination Technicians. It should be noted, that any edits to this file will however be removed when the application is upgraded.


Shortcut Keys

  • Alt+E - Export
  • Alt+F - File menu
  • Alt+H - Help menu
  • Alt+I - Images menu
  • Alt+L - Language menu
  • Alt+N - Neighbourhood
  • Alt+O - Output menu
  • Alt+S - Save Folder
  • Alt+T - Transform menu
  • Alt+F4 - Exit

  • Ctrl+N - Neighbourhood
  • Ctrl+S - Save Folder

  • F1 - Help (about)

Source Code

Source code can be downloaded from GitHub


Change Log

Version 2.1

  • Added support for custom objects to sims2tools:asObjectTitle(@guid) and sims2tools:asObjectDesc(@guid)
  • Added careers transform
  • rufio and rufioPlus transforms now save with .csv extensions (no longer .txt)
  • rufio and rufioPlus transforms now correctly escape a double quote within a text string.

Version 2.0

  • Recompiled to fix compression and SimPe issues - see here

Version 1.7

  • Fixed an issue when using rufio.xsl or rufioPlus.xsl and no images are selected for extraction.

Version 1.6

  • Fixed issue with spaces in export path when using transforms.

Version 1.5

  • Shift-Click "EXPORT" button to run selected (non-rufio) transform on previously exported hood xml.
  • Census, Memories and WhoKnowWho transforms now use the .csv extension (and not .txt).
  • Added sims2tools:asObjectTitle(@guid) and sims2tools:asObjectDesc(@guid) to return the object's title and description (from the associated CTSS resource).
  • Updated memories.xslt to include the memory title (CTSS entry).
  • Resolved issues around Hood Exporter keeping output files locked, should now be able to open output files without the need to close Hood Exporter first.

Version 1.4

  • Added missing UI flags (from BCON 0x011C)
  • Added whoknowswho transform

Version 1.3

  • Added asObjectName(guid) to the custom XSLT functions
  • Added census transform
  • Added memories transform

Version 1.2

  • Various changes (to be honest, so long since I did them I've forgotten!)

Version 1.0

  • Initial release


Files