A DLL Plugin for SimCity 4 that extends the query UI.
The plugin can be downloaded from the Releases tab: https://github.com/0xC0000054/sc4-query-ui-hooks/releases
Some objects can be copied by holding down the shift key and clicking on them with the query tool.
Clicking a building will activate the Place Lot tool with the building's lot selected. Note that the exact building may be different if the lot uses Building Families.
Clicking certain flora types will activate the Place Flora tool with that flora type selected. Note that this only works with the flora objects that have a hover query tool tip.
The DLL provides a number of new variables that can be used in the LTEXT files
of a building query dialog in the form of #variable_name#
.
Variable List
Name | Description |
---|---|
building_full_funding_capacity | The cost for Education, Fire, Health, Police and Power buildings at the full (100%) capacity. For Fire and Police stations this is the coverage radius. |
building_full_funding_coverage | The cost for Education, and Health buildings at the full (100%) coverage radius (School Bus/Ambulance). |
building_is_w2w | Shows a 'Yes' or 'No' value based on whether the building has a W2W occupant group. |
building_styles | Shows a building's styles in a pipe-separated list. |
building_style_lines | Shows a list of the building's styles, with each style after the first one on its own line. E.g: Chicago 1890 New York 1940 |
building_summary | The building summary the game shows in its hover tool tips. E.g: Low-Wealth Residential |
growth_stage | The growth stage of the building's lot. |
mysim_name | The name of the MySim that lives in the selected residence. |
r1_occupancy | The current number of R§ occupants. |
r1_capacity | The R§ occupant capacity. |
r2_occupancy | The current number of R§§ occupants. |
r2_capacity | The R§§ occupant capacity. |
r3_occupancy | The current number of R§§§ occupants. |
r3_capacity | The R§§§ occupant capacity. |
cs1_occupancy | The current number of Cs§ occupants. |
cs1_capacity | The Cs§ occupant capacity. |
cs2_occupancy | The current number of Cs§§ occupants. |
cs2_capacity | The Cs§§ occupant capacity. |
cs3_occupancy | The current number of Cs§§§ occupants. |
cs3_capacity | The Cs§§§ occupant capacity. |
co2_occupancy | The current number of Co§§ occupants. |
co2_capacity | The Co§§ occupant capacity. |
co3_occupancy | The current number of Co§§§ occupants. |
co3_capacity | The Co§§§ occupant capacity. |
ir_occupancy | The current number of I-R occupants. |
ir_capacity | The I-R occupant capacity. |
id_occupancy | The current number of I-D occupants. |
id_capacity | The I-D occupant capacity. |
im_occupancy | The current number of I-M occupants. |
im_capacity | The I-M occupant capacity. |
iht_occupancy | The current number of I-HT occupants. |
iht_capacity | The I-HT occupant capacity. |
Multiple *_occupancy
and *_capacity
variables can be combined in a LTEXT query to show the filled/available occupancy.
e.g. #cs1_occupancy#/#cs1_capacity#
.
The TerrainQuery command now shows the x, y, and z variables without truncating to the first decimal place, and the
cell moisture value is now provided as part of the standard query info.
This mode is accessed by holding the Alt
key. It shows the humidity and ambient wind information, this data appears
to be for the entire tile instead of varying per-cell.
These tool tips are accessed by holding Control + Alt + Shift
when hovering over an appropriate item.
This tool tip provides the flora object's exemplar name, birth date, and last seeding date.
This tool tip provides technical info about the transportation networks, excluding power lines and pipes.
This tool tip provides the prop object's exemplar name.
This file contains the following options.
This option controls whether the query sounds are played when clicking on an item to open the query dialog or copy the lot, the default is true. The occupant query sound properties affected by this option are SFX:Query Sound, SFX:Query Sound Abandoned and SFX:Query Sound Decayed.
This option controls whether the building name and plugin file path will be written to the log file when the building is queried, the default is false.
- Copy the headers from
src/public/include
folder into your GZCOM DLL project. - Implement
cIBuildingQueryDialogHookTarget
,cIBuildingQueryToolTipHookTarget
,cINetworkQueryToolTipHookTarget
and/orcIQueryToolTipAppendTextHookTarget
as additional interface(s) on your GZCOM DLL director. - Subscribe for the notifications in
PostCityInit
and unsubscribe inPreCityShutdown
.
An implementation of this callback interface receives a message before and after the building query dialog is shown.
The intended use case for these callbacks is that the implementer can use the game's cISCStringDetokenizer::AddUnknownTokenReplacementMethod
function
to register a function to handle occupant-specific string tokens in their BeforeDialogShown
method, and unregister it in their AfterDialogShown
method.
The Tool Tip hook callbacks have a debugQuery
parameter, this parameter is set to true
if the user activated the
game's advanced/debug query mode by holding down Control + Alt + Shift
before hovering over an item.
cIBuildingQueryCustomToolTipHookTarget, cIFloraQueryCustomToolTipHookTarget, cINetworkCustomQueryToolTipHookTarget and cIPropQueryCustomToolTipHookTarget
An implementation of these callback interfaces should try to target a narrow set of activation conditions
to avoid conflicts between different callback subscribers.
The tool tip callbacks for a specific occupant will be stopped after a subscriber reports that it handled
the tool tip, the order that the callbacks are executed in is unspecified.
If no subscriber set a custom tool tip for the specific occupant, the game's default tool tip will be shown.
An implementation of this callback interface allows callers to append one or more lines of text to the end of
the current tool tip. Multiple lines of text can be added by separating them with \n
.
The number of lines added to the query and the length of each line should be kept as small as possible. SC4
has a limited amount of space that it reserves for the query tool tip text, and it may fail to display a tool
tip that exceeds its limits.
See BuildingQueryVariablesProvider.cpp and QueryToolTipProvider.cpp.
- SimCity 4 version 641
- Windows 10 or later
The plugin may work on Windows 7 or later with the Microsoft Visual C++ 2022 x86 Redistribute installed, but I do not have the ability to test that.
- Close SimCity 4.
- Copy
SC4QueryUIHooks.dll
andSC4QueryUIHooks.ini
into the top-level of the Plugins folder in the SimCity 4 installation directory or Documents/SimCity 4 directory. - Start SimCity 4.
The plugin should write a SC4QueryUIHooks.log
file in the same folder as the plugin.
The log contains status information for the most recent run of the plugin.
This project is licensed under the terms of the MIT License.
See LICENSE.txt for more information.
gzcom-dll Located in the vendor folder, MIT License.
EABase Located in the vendor folder, BSD 3-Clause License.
EASTL Located in the vendor folder, BSD 3-Clause License.
Windows Implementation Library - MIT License
SC4Fix - MIT License
Frozen - Apache 2.0 License.
Boost.Algorithm - Boost Software License, Version 1.0.
Boost.PropertyTree - Boost Software License, Version 1.0.
sc4-more-building-styles - MIT License
- Visual Studio 2022
- Open the solution in the
src
folder - Update the post build events to copy the build output to you SimCity 4 application plugins folder.
- Build the solution
Visual Studio can be configured to launch SimCity 4 on the Debugging page of the project properties.
I configured the debugger to launch the game in full screen with the following command line:
-intro:off -CPUcount:1 -w -CustomResolution:enabled -r1920x1080x32
You may need to adjust the window resolution for your primary screen.