Jump to content

17 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

This is a utility that assigns building styles to a plugin, or a folder of plugins. The application is available in two versions, a Windows GUI application and a cross-platform console application.

Download (Windows GUI): https://community.simtropolis.com/files/file/37048-assign-building-styles-tool/

Download (Console): https://github.com/0xC0000054/sc4-assign-building-styles/releases

Source Code: https://github.com/0xC0000054/sc4-assign-building-styles

Windows GUI

This is a Windows application with a graphical user interface.

System Requirements

Console

This is a cross-platform command line application.

System Requirements

.NET 9.0 Runtime (Windows and Linux)

Usage

AssignBuildingStylesConsole OPTIONS <files or directories>

Options:

Long form                          Short form Description
--building-styles -s                      The hexadecimal building style ids. Multiple values must be separated by commas.
--wall-to-wall -w Indicates if the building are wall to wall (W2W). Must be true or false.
--recurse-subdirectories -r Search subdirectories of the input folder for DBPF files.
--install-folder-path -i The path of your SimCity 4 installation folder. Used to find parent cohorts.
--plugin-folder-path -p The path of your SimCity 4 plugin folder. Used to find parent cohorts.
--exemplar-patch -e The output path to use when writing an exemplar patch.

Example:

AssignBuildingStylesConsole --building-styles 0x2000,0x2001 --wall-to-wall true file.dat

The above command will edit all building exemplars in file.dat to have the Building Styles property set to 0x2000,0x2001 and the Building is W2W property set to true.

  If you would like to make voluntary contributions to support me in continuing to create more content for SimCity 4, I accept donations via PayPal: https://paypal.me/0xC0000054
 

Thanks to the few people who have donated to me.

  • Like 8

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Excellent!  I will try testing this out and see how it works.

It'd be nice if the options could be defined somewhere in an INI file so that we don't need to retype them so much.  Otherwise, this is begging for a batch file.

  • Like 1

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    3 hours ago, Kel9509 said:

    It'd be nice if the options could be defined somewhere in an INI file so that we don't need to retype them so much.  Otherwise, this is begging for a batch file.

    Any type of configuration file would be a lot of work to add. Batch files or other forms of scripting are also probably more intuitive for users than a mix of configuration files and command line arguments.

    The installation and plugin folder paths may not be necessary depending on your plugins. It is necessary for overrides of base-game Maxis buildings because they placed the ExemplarType property that I use to identify building exemplars at the top of a parent cohort chain.

    • Thanks 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Release version 1.1.0, which has the following changes:

    • Added an INI file to allow options to be set without needing command line arguments.
      • The command line arguments will override the INI file.
      • The target file/folder path still needs to be set on the command line.
    • Remove the ExemplarCategory property that PIM-X adds.
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Release version 1.2.0, which has the following changes:

    • Add support for creating exemplar patches.
    • Add the Building Styles PIMX Template Marker property instead of removing the Exemplar Category property.
    • Like 1
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Release version 1.3.0, which has the following changes:

    • Added a Windows GUI application.
    • Various optimizations.
    • Thanks 4

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Release version 1.3.1, which has the following changes:

    • Fixed a crash when reading some exemplars.
    • Fixed a UI glitch in the WinForms app.

    Uploaded the Windows GUI version to the STEX.

    • Thanks 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Is there a specific way that the INI file needs to be configured to work?  Is it just a copy of the command line options?  I noticed that there was no example INI in either the zip file or the readme, so I just want to be sure.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    53 minutes ago, Kel9509 said:

    Is there a specific way that the INI file needs to be configured to work?  Is it just a copy of the command line options?  I noticed that there was no example INI in either the zip file or the readme, so I just want to be sure.

    The INI file only applies to the console app, there is a copy on GitHub and I updated the download.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    48 minutes ago, Null 45 said:

    The INI file only applies to the console app, there is a copy on GitHub and I updated the download.

    Ok, thanks.  I tried the GUI version and it looked fine.  Checked the Options button to see it pulled in my Simcity4 locations properly.  Then, I clicked on the Wall-to-wall option and it selected it.  I tried exiting at that point but it wouldn't exit.  Had to kill the process to get it to exit.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    1 hour ago, Kel9509 said:

    I tried exiting at that point but it wouldn't exit.  Had to kill the process to get it to exit.

    That shouldn't happen unless the processing was running. I process data on a background thread and block exiting the app until I am at a point that DBPF files are not being modified and can shut down the background thread without risking data corruption in the 'overwrite original files' mode. The console app doesn't do that, but it probably should.

    It also looks like I forgot to disable that check box and the style text box when processing is running. But changing it won't cause any harm because the background thread uses a copy of the data that it gets when it is started.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I'm happy to see the GUI version, since I'm not that fond of using command lines. The GUI looks nice and clean, and it seems that it found my installation and plugins folder automatically when I clicked on the "Options..." button (maybe it should be named "Settings" instead?).

    I didn't have time for a proper text, so I only had a very quick look, so I experienced the same as @Kel9509 while I randomly picked stuff in the GUI, and when I clicked the W2W option, it looked like the program apparenly locked up (a red "x" appeared on top of the checkbox), so I had to kill it in the task manager.

    Another idea: instead of entering the building styles manually (there is no indicator about the proper format, too), maybe you could configure the styles in the settings.xml once and then have a button "Select styles..." which opens a small window with checkmarks for every style, which adds the selected IDs to the list without the need to type something. *:)

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    3 hours ago, Andreas Roth said:

    I randomly picked stuff in the GUI, and when I clicked the W2W option, it looked like the program apparenly locked up (a red "x" appeared on top of the checkbox), so I had to kill it in the task manager.

    That red x is the input validation for the style id text box, hovering over the error icon shows a tool tip describing the format. For the next version, the same information will also be displayed above the text box. I also changed it so an empty text box is not treated as an error.

    3 hours ago, Andreas Roth said:

    maybe you could configure the styles in the settings.xml once and then have a button "Select styles..." which opens a small window with checkmarks for every style, which adds the selected IDs to the list without the need to type something. *:)

    Settings.xml is not intended to be user editable. It is also not feasible for the application to know every style. :)

    I went with a simple text box because it matched the behavior of the console app, and was way easier than trying to figure out how to download and parse @Ulisse Wolf's Building Styles Master IID Google spreadsheet. Plus even that approach would still need a text box to handle styles that are not in that list.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Well, since the discussion about the custom buiding styles never really managed to come to a mutual agreement, I figure that custom building styles might end up depending on the personal preference of the user. Some people would probably want to pick from an extensive list of styles, while others prefer a small list with well-chosen styles that match their playing preference.

    Hence it might come in handy if the selection of styles would be user-configurable, and a checkbox-driven selection would be much easier to use than entering IDs manually. Of course, it would be nice if it can do both, similar to any e-mail client, where you can type in e-mail addresses manually, or pick one or more from your address book.

    So my idea was to have said button that opens a window with a selection of styles to pick from, and when you click "OK", the IDs will show up in the text box, separated by commas, or semicolons, or whatever is allowed to use as separator.

    I see what you mean with "the text box matched the behavior of the console app", but the entire reason about using a GUI is that you don't need to type in commands or other data that you probably can't or don't want to memorize (or because you're just lazy). *;)

    • Like 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    13 hours ago, Andreas Roth said:

    Hence it might come in handy if the selection of styles would be user-configurable, and a checkbox-driven selection would be much easier to use than entering IDs manually. Of course, it would be nice if it can do both, similar to any e-mail client, where you can type in e-mail addresses manually, or pick one or more from your address book.

    For a configuration format, I am leaning towards CSV with something like the following:

    "Style ID","Style Name",Author,Description
    0x2000,"Chicago 1890","Maxis","Chicago 1890 Description"
    0x2001,"New York 1940","Maxis","New York 1940 Description"
    0x2002,"Houston 1990","Maxis",Houston 1990 Description"
    0x2003,"Euro-Contemporary","Maxis","Euro-Contemporary Description"

    The intention behind that format is making it easier to merge data from the Building Styles Master IID spreadsheet.

    I also have not decided on a UI, Microsoft provides both a list control with support for check boxes and a basic spreadsheet editor. I will have to see which one works better for that usage.

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Release version 2.0, which has the following changes:

    AssignBuildingStylesConsole:

    A breaking change to the command line format. Exemplar patches are now created using the -e command line argument, and multiple files are treated as input

    AssignBuildingStylesWinForms:

    Added a Choose Styles dialog.

    This dialog will be populated from the Building Styles Master IID spreadsheet when it is first opened. This data is cached in BuildingStylesCache.json, so it won't make any more network requests unless that file is deleted.

    • Like 1
    • Thanks 1

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections