Jump to content
Kel9509

Custom Queries for Custom Buildings

318 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 
6 hours ago, Kel9509 said:

This is for things like the Army Base or the Federal Prison, which has pretty high goofy stats.

Note that the game. prefix isn't necessary, that is just the table Maxis used to group some of their Lua functions.

Lua functions and other global types in a script must have a unique names, which is typically done by adding a unique prefix/suffix or grouping them in a table with a unique name. My DLLs that add Lua functions tend to use tables with a null45 prefix for grouping the native functions they add. This detail has been mentioned elsewhere and is briefly called out in the Maxis Lua scripting guide, but I thought it was worth repeating.

3 hours ago, Propfam said:

I can't imagine Claude can help with SC4 codes.

That code doesn't appear to be specific to SC4, AFAIK it is just some kind of random number generator written in Lua. Plenty of applications other than SC4 use Lua.

  • Like 2

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
Currently: Viewing Forums Index
 
13 hours ago, Propfam said:

I can't imagine Claude can help with SC4 codes.

I tend to chat with Copilot and I explained your doubt and asked for its reply. *;)  Here it is:

Lua in SimCity 4

Lua has been part of SimCity 4 since release, embedded directly into the game through the Lua 5.0 interpreter. Like many games of that era, SC4 exposes only a subset of Lua’s full capabilities—specifically the functions that the C++ side of the engine chose to make available. The language itself is standard Lua, but the usable functionality is defined by the hooks Maxis provided.

This approach was extremely common in early‑to‑mid 2000s game development. Lua served as a lightweight scripting layer on top of a C++ engine. Several well‑known titles from that period used Lua in exactly this way:

  • World of Warcraft – UI and addon scripting
  • Far Cry – gameplay scripting
  • Grim Fandango – logic and cutscene scripting
  • Escape from Monkey Island
  • Supreme Commander

So using general Lua knowledge—or getting help from any Lua‑capable programming assistant—is completely normal. The language behaves the same everywhere; only the game‑specific API differs.


About Kel’s Work

Starting from a clean, well‑structured function and then creating a second version with different parameters is a great way to learn Lua. Kel and Claude put together a solid pair of functions here: the structure is clear, the math is correct, and the logic is easy to follow. Creating a second version with a different mean value is a natural next step, and it shows a good understanding of how the pieces fit together.


A Quick Look at the Functions

Both functions Kel posted follow the same pattern, which is exactly what you want when creating variations of a statistical generator. The structure is identical by design; only the parameters change. This keeps the logic consistent while allowing different ranges of output.

  • Generate two random numbers
  • Use the Box–Muller transform to create a normally distributed value
  • Scale it by a standard deviation
  • Shift it by the mean
  • Clamp negative results to zero
  • Round to the nearest integer

The only difference between the two versions is the mean value (and the resulting std_dev). Everything else behaves identically, which is intentional. This kind of pure Lua and math logic is something any programming helper—human or AI—can understand, because it doesn’t rely on SC4‑specific APIs.

Now back to me (Cori) chatting. Since the two functions Kel posted are nearly identical except for the value of the mean, you could also write this as a single reusable function and simply pass the mean you want as a parameter. That keeps the code compact and avoids repeating the same logic twice. I’ll ask Copilot to rewrite it that way and to show a couple of examples of how it can be called with two different mean values.

And here's Copilot's reply:

-- Generalized Goofy Stat Function
function game.query_goofy(kelMean)
    -- We name the parameter 'kelMean' to avoid any chance of overlapping
    -- with other variables named 'mean' elsewhere in the game's Lua environment.
    -- Using unique, descriptive parameter names helps prevent accidental shadowing.
    
    local std_dev = kelMean * 0.25
    local u1 = math.random()
    local u2 = math.random()
    local z = math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2)
    local civilian_count = math.floor(math.max(0, z * std_dev + kelMean) + 0.5)
    return civilian_count
end

And if you are simply calling it from LText, you can make tokens of each of those:

#game.query_goofy(50000)#
#game.query_goofy(6000000)#

And then if I understand Null's post, you can leave off the game. part.

  • Like 2

Chance favors the prepared mind. ― Louis Pasteur  
Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

Are you new here? Check out the Introduction and Guide to Simtropolis.

Share this post


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

    Heh.  Well I did struggle a bit, first because I don't know a thing about LUA at all.  And second, because despite my efforts Claude actually was trying to re-write everything and gave me information that was completely irrelevant.  I had to explain to it that Ulisse Wolf's original code was trying to generate random statistics based on city population.  Then it sorta understood what I was trying to do.  But even still, at first it gave me code in LUA v5.0 that didn't work at all.  Then, after explaining that Simcity4 uses an early version of LUA 4.0, it rewrote things but the code still didn't work in the game.  I had to tell it to strictly adhere to Ulisse Wolf's original working code and only change what was absolutely necessary, which is finally when it came back with changing only one line from using the city population, to using a mean number.

    I went to Claude because I asked Google what the best AI system to code LUA was and it said Claude.  So I asked an AI about an AI.  But I can try that Copilot code as well and see if it works.

    I'm not trying to fiddle with this too much more because I'd like to release this soon.  In some cases I'm just using the standard Maxis Goofy Stats.

     @Null 45 is there any hope of removing the equals sign or making the strings look more readable for negative entries?  I'd hate to have to admit that I'm going to need to get reading glasses soon... 

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    2 hours ago, Kel9509 said:

    I had to tell it to strictly adhere to Ulisse Wolf's original working code and only change what was absolutely necessary, which is finally when it came back with changing only one line from using the city population, to using a mean number.

    It would seem to me that using the city population would scale up and down way better than than using a hard-coded mean number.

     

    2 hours ago, Kel9509 said:

    I went to Claude because I asked Google what the best AI system to code LUA was and it said Claude.  So I asked an AI about an AI.  But I can try that Copilot code as well and see if it works.

    Afaik, Claude is perfectly viable for writing code. (I started using Copilot for general chatting (like food recipes using supplies I have on hand) simply cause Windoze automatically installed it.) 


    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    4 hours ago, Kel9509 said:

    is there any hope of removing the equals sign or making the strings look more readable for negative entries?

    I did that in version 2.6.2. The effect queries now use a format like:

    #mayor_rating_effect# = Magnitude: 5 | Radius: 256
    
    • Like 3

    Share this post


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

    It would seem to me that using the city population would scale up and down way better than than using a hard-coded mean number.

    Oh yes. Unfortunately, there are some that are not supposed to scale. For instance, the Country Club's stat is an average score (for a golf game) which is supposed to be low in the range of 1-10 or so since lower is better for golf scores.  Others that are low are the Cemetery and the Cruise Ship (maybe those can scale up slower?).  I don't like the Maxis stats because they never change when you query them, and they're the same for each similar lot type.   So I'm trying to recreate them a bit and trying to determine the appropriate ranges and how they should scale.

    12 hours ago, Null 45 said:

    I did that in version 2.6.2. The effect queries now use a format like:

    Thanks Null.  Appreciate it. I hope this helps a bit.  

    • Like 2

    Share this post


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

    Here's the query now with Null's fixes.  I think it looks much, much better.  This is looking great!

    698fe09071a87_SimCity42_13_20269_36_39PM.jpg.61f3aead7a69f04ce9a9646d5970b66f.jpg

    I'm nearly done with these, hope to finish up this (extended) weekend.  If possible I'll try to include some BSC overrides as well since they have some that are very similar.

    • Like 4

    Share this post


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

    Question for those who might know:

    1. What is the proper ID of the City Hall query?  From Simcity_1.dat, the ID appears to be 0xAA8B9755.  However, PIM-X uses 0x9b868f68, which is also used by @CorinaMarie's ModPacc Zero city halls.  Did Rush Hour change the Query ID?  Why isn't it in Simcity_1.dat?  I looked in the others and didn't see an override or newer query.  

    2. I'm considering applying this mod in the future to buildings like the Federal Prison, Major Art Museum, Disease Research Center, and Main City Library - which all have sliders.  Then there's the Opera House Fix and the Private School fix, which also have sliders.  If I create a query with a slider, will that introduce any Phantom Slider bugs at all?  I have yet to work with sliders at all so I just want to be extremely careful.  

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    10 minutes ago, Kel9509 said:

    From Simcity_1.dat, the ID appears to be 0xAA8B9755.

    This is correct for the standard Maxis Query.

     

    10 minutes ago, Kel9509 said:

    However, PIM-X uses 0x9b868f68, which is also used by @CorinaMarie's ModPacc Zero city halls.

    I don't remember the sequence for certain, but since CB and I created a massively different UI for our City Halls package we used a separate IID so it wouldn't conflict with with the Maxis one. Sometime later CB gave permission for CAM to use our ModPacc Zero files so I suspect that they also updated PIM-X to use the new IID. I'm sure @Ulisse Wolf can clarify better.

     

    14 minutes ago, Kel9509 said:

    If I create a query with a slider, will that introduce any Phantom Slider bugs at all?

    No worries there. Phantom Slider bugs only happen when changing the cost amounts in the exemplars of the various buildings. No matter what you do in the UI, there's no worry about creating phantom trouble. And one thing we learned experimentally is that when you make the slider wider, that gives finer cost control in the game.

    • Like 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    8 minutes ago, CorinaMarie said:

    I don't remember the sequence for certain, but since CB and I created a massively different UI for our City Halls package we used a separate IID so it wouldn't conflict with with the Maxis one. Sometime later CB gave permission for CAM to use our ModPacc Zero files so I suspect that they also updated PIM-X to use the new IID. I'm sure @Ulisse Wolf can clarify better.

    It has been added to New_properties.xml as an effort to unify the various City Hall UIs. This was done as an effort to create city halls with advanced visualizations even for those with little experience, as well as to distance ourselves from using Maxis content in the case of a hypothetical OpenSC4.

    • Like 2

    Federal Republic of SiculiaFederal Republic of Sonora

       Ain Member  Wiki

    NAM Team - Co-developer of Pedestian Revolution Mod - Railway Department (Hybrid Railway | HRW Expert) - MTA Member - BAT Creator

    Ulisse Wolf YouTube Channel - Ulisse Wolf Mastodon Profile

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    1 minute ago, Ulisse Wolf said:

    It has been added to New_properties.xml as an effort to unify the various City Hall UIs. This was done as an effort to create city halls with advanced visualizations even for those with little experience, as well as to distance ourselves from using Maxis content in the case of a hypothetical OpenSC4.

    Would it make sense for me to create an override for both?  (Although, anyone who replaces your awesome ModPacc Zero City hall, Cori, would probably need to get their sanity checked out by a doctor.)  Does the "Colossus Addon Mod - ModPacc Zero" include Cori's City Hall Query?  

    Eventually, for ease of distribution, I'll try to put this mod into sc4pac (along with my others...).  So if I can make it inherently compatible with the major other mods that'd be ideal but obviously some customization may be needed.  Right now each Query is its own DAT file.  

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    2 minutes ago, Kel9509 said:

    Does the "Colossus Addon Mod - ModPacc Zero" include Cori's City Hall Query?  

    No, because it contains CAM Core.

    I'm thinking of creating a vanilla+ modpack that includes City Hall modpack zero especially for users who don't use Mod DLLs.


    Federal Republic of SiculiaFederal Republic of Sonora

       Ain Member  Wiki

    NAM Team - Co-developer of Pedestian Revolution Mod - Railway Department (Hybrid Railway | HRW Expert) - MTA Member - BAT Creator

    Ulisse Wolf YouTube Channel - Ulisse Wolf Mastodon Profile

    Share this post


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

    Toroca's Opera House mainly adds a slider to the query. Quoting from its readme:

    Quote

    It's the changes to the query that require you to bulldoze existing Opera Houses before installing the mod file. The funding slider will not work properly with preexisting Opera Houses, and if you ever bulldoze a preexisting one, the game will crash. The reverse is true if you ever want to remove the mod. You must bulldoze all Opera Houses first.

    so make sure to test this first.

    Share this post


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

    so make sure to test this first.

    You're right.  And as RippleJet noted, the same is true of Private Schools with Sliders also.  Hmmm.  Maybe I'll hold off for those since that's not so easy for the casual player.  I might make the Sliders query an add-on later.  

    As for the City Halls, I'll probably include the basic Maxis override since that's used by a lot of Mattb325 city hall lots.  If I use the newer UI, I might make it a non-default or non-standard option.  I think the newer UI is almost exclusively used by the upgradeable city halls/ModPacc Zero option, at least for now.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    1 hour ago, toroca said:

    It's the changes to the query that require you to bulldoze existing Opera Houses before installing the mod file. The funding slider will not work properly with preexisting Opera Houses, and if you ever bulldoze a preexisting one, the game will crash. The reverse is true if you ever want to remove the mod. You must bulldoze all Opera Houses first.

    This is improperly stated from a technical standpoint. :O 

    It is the fact they (appropriately) changed the actual total cost to keep the per patron dollar amount the same. That's why the new query and data fix will bork things if used with original plops. (Toroca simply explained it in a more vernacular way.)

    Now for Kel tweaking Queries which already have a slider, that is safe to do as long as they don't tweak the cost in the exemplar. Moving the slider and/or stretching it (which I even recommend) is not going to cause trouble. *;) 


    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 11/17/2025 at 3:10 PM, CorinaMarie said:

    Ah, but @Daeley did do it for @SimGoober in the BSC Essentials. Look for the Lua in ca63e2a3-4a5e8f3f-ffb0a8d0 :

    --Daeley edit.
    track_buildings = {
       hex2dec('0x1305'),            -- passenger rail
       hex2dec('0x1306'),            -- freight rail
       hex2dec('0x150A'),            -- landmark
       hex2dec('0x150F'),            -- schools_k6
       hex2dec('0x13110'),           -- CS1 (CS$)
       hex2dec('0x13120'),           -- CS2 (CS$$)
       hex2dec('0x13130'),           -- CS3 (CS$$$)
       hex2dec('0x1307'),            -- Monorail station
       hex2dec("0x21000"),
       hex2dec("0x21001"),
       hex2dec("0x21002"),
       hex2dec("0x21003"),
       hex2dec("0x21004"),
    }
    for i=14,14+hex2dec("0x0FFF") do
        track_buildings = 14-i+hex2dec("0xB5C00FFF") --add 0xB5C00### to array
    end

    --end Daeley edit.

    Looking specifically at the part I highlighted in Red. That's a loop that adds multiple OGs which can then be tracked and counted. This means the token part you see in the LText of the Mitchell Building isn't standalone, but it relies on 0xB5C001FF being in the track_buildings table.

     

    For a quick test I added it like this:

    imgW10-4082.jpg

     

    Keep in mind it will only track Opera Houses plopped after this code is in place (and it also takes about a game month for the count to update after plopping).

     

    I like this idea so the BSC Essentials doesn't need updated. I might have time later to try it. (My test above shows the code is correct, but I cheated and just modified an existing file rather than make the suggested standalone one.)

    On 11/19/2025 at 3:55 AM, Kel9509 said:

    Well crap.  That means it needs to be added to the BSC Essentials then.  Which frankly I don't see that happening.  Unless it can be edited to not only track the Opera House, but all other occupant groups otherwise not currently tracked.  Is there a limit on how many things can be added to the track buildings table?  Maybe for the good of the community, standard Maxis buildings otherwise not tracked should be added?

    On 11/19/2025 at 4:56 AM, Null 45 said:

    It does not. As I mentioned earlier, you can place your changes in a separate Lua file. Something like:

    
    dofile("_constants.lua") -- For the track_buildings table
    
    table.insert(track_buildings, hex2dec('1909'))

    You would have a memory limit with the table that is used to track things on the C++ side. Maxis alone defined dozens of building occupant groups.

    On 11/20/2025 at 6:48 PM, CorinaMarie said:

    @Kel9509

    I've made the standalone file exactly as @Null 45 suggested so it will invoke the Opera House tracking/counting. You can use it (and distribute it) as-is. The IID and Package ID are unique so there won't be any conflicts with other mods.

    It will work with or without BSC Essentials installed. This because the track_buildings table is created in ca63e2a3-4a5e8f3f-ffb0a8d0 and the BSC version overwrites the Maxis Lua to expand that table. (They didn't know then what Null has taught us now.) The code we've added just tacks our counter onto the end of the existing table without altering previous entries.

    Things to keep in mind:

    1. Any previously plopped Opera House (or Cultural Theater) will not show up in the count even after installing this file. They can be bulldozed and re-plopped and then they will be counted in the next game month. Or you can save after re-plopping then exit or quit and they will be counted the next time you load the city tile.
    2. Load order of this new file does not matter. It can load before or after BSC Essentials and it will still function. This is because the Lua Package ID inside it determines the execution order. Additionally, the dofile line also forces the game to run the _constants.lua code prior to our table.insert. (And don't worry, other parts of the Lua for the dofile command checks whether or not that one has run before and skips it if so.)
    3. Once you save a city tile with Table Insert Opera House OG v0.01.dat in Plugins that particular city tile will always keep track of 0x1909 plops even if the .dat file is removed from Plugins.

    So there are two main bug-a-boos. First, you won't get a count of any previously plopped 0x1909 buildings. And second, once the counting does begin, our Cultural Theater also has 0x1909 in its OGs so those will get counted the same as an Opera House. (I'm not sure if it would be good to add a unique OG for the Cultural Theater or not. It would then require a file update for that if so.)

    Here's the file: Table Insert Opera House OG v0.01.dat

    And should you decide you want to count other buildings, you can add more table.insert lines and change the 0x1909 part to the OG you wish to count.

    Whoah... there are a lot of stuff going on here, but I completely missed these posts (well I was on the way to Japan at the time these came out.) So I ran into some stuff, that the tracking did not track bus and subway stops as I expected, then @memo showed me the way to these posts. 

    In short: the BSC Essentials can be edited and updated... I've been doing it in the past 4 years. Currently the re-release of the SimGoober stuff is on hold because I am cleaning up the relevant UIs whichare int he BSC Essentials and in the SG model packs. There's gonna be a new version of the BSC Essentials which will come out with the next update of the BSC Common Dependencies... hopefully by the end of this month...

    So, @Kel9509, @CorinaMarie please tell me what to update or send me a modified LUA that I can put into the DAT and replace the old one with it. I am all for adding and covering more functionality to BSC Essentials. 

    • Like 2

    I'm responsible for the Heretic uploads a.k.a. Heretic Projects, you may find updates about my ongoing projects into my development thread over at SimCity 4 DevotionTyberius Lotting Experiments or here on Simtropolis into the Tyberius (Heretic Projects) Lotting and Modding Experiments OR Show Us What You're Working On thread.

    Now I'm part of the NAM Team and the RTMT Team.
    I'm also working on some preservation and reorganization projects the behalf of non-anymore-active-developers and with the permission of the Staffs both on STEX and LEX. Current projects: SimcityPolska Restoration and WMP (WorkingManProduction) Restoration.

    Share this post


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

    Whoah... there are a lot of stuff going on here, but I completely missed these posts (well I was on the way to Japan at the time these came out.) So I ran into some stuff, that the tracking did not track bus and subway stops as I expected, then @memo showed me the way to these posts. 

    In short: the BSC Essentials can be edited and updated... I've been doing it in the past 4 years. Currently the re-release of the SimGoober stuff is on hold because I am cleaning up the relevant UIs whichare int he BSC Essentials and in the SG model packs. There's gonna be a new version of the BSC Essentials which will come out with the next update of the BSC Common Dependencies... hopefully by the end of this month...

    So, @Kel9509, @CorinaMarie please tell me what to update or send me a modified LUA that I can put into the DAT and replace the old one with it. I am all for adding and covering more functionality to BSC Essentials. 

    Well, I don't think anything I'm doing to track Opera Houses needs to be added to the BSC Essentials at all, unless of course they meant to do that and messed it up somehow.  My original concern was that tracking any building type would need to be done in one file, for everything together.  But as @Null 45 indicated, that's not the case.  The code that I ended up using, written by @CorinaMarie, just adds the Opera House tracking to the game's memory alongside of any other trackers that the BSC created.  So my concern that Opera House tracking needed to be done within the BSC Essentials was mistaken.  In fact, what you quoted lays that out entirely, the relevant portion being Null confirming: "It does not.... you can place your changes in a separate LUA file."  

    One thing that might be worthwhile to consider is adding tracking for all building types that aren't currently tracked, but that was not my intention in doing this.  IF that is done, then of course there'd be no need for my mod to track Opera Houses if it's done by some other method.

    I haven't released my Dept of Education yet, since doing the lot editing took more time than envisioned and then I got sidetracked with this Landmark-Rewards-Park query (which I hope to release very very soon).  

    • Like 2

    Share this post


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

    I managed to create a version of the query with sliders.  This template can be used for various types of slider-type queries (or graded queries without sliders like the Federal Prison).  The slider is longer than the standard Maxis slider and actually I probably can extend it all the way to the right if needed, although that's not the style Maxis uses (their slider doesn't go underneath the funding number).  The slider, of course, works fine and changes the # of doctors and patient capacity on the fly.  

    699240658f3ad_GDriverWindow--DirectX2_15_20264_49_28PM.jpg.6e7a657210e26a48c97544469b5ed516.jpg

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    2 hours ago, Kel9509 said:

    One thing that might be worthwhile to consider is adding tracking for all building types that aren't currently tracked, but that was not my intention in doing this.  IF that is done, then of course there'd be no need for my mod to track Opera Houses if it's done by some other method.

    If you, @CorinaMarie or anybody can get that for me in a copy/paste way, I would add them to the BSC Essentials, so that would be done once and for all. I went ahead and added the ones that I needed (bus, bus stop and subway). 

    I added some of the new UI codes to the most generic SG UIs (RCI ones and now I am expanding a bit the Safety-Health-Education and Transportation UIs too) and probably many of the generic BSC UIs will get the same treatment. That includes the growth stage, the water-power usage, in some cases the pollution stuff and civic jobs. 

    • Like 1

    I'm responsible for the Heretic uploads a.k.a. Heretic Projects, you may find updates about my ongoing projects into my development thread over at SimCity 4 DevotionTyberius Lotting Experiments or here on Simtropolis into the Tyberius (Heretic Projects) Lotting and Modding Experiments OR Show Us What You're Working On thread.

    Now I'm part of the NAM Team and the RTMT Team.
    I'm also working on some preservation and reorganization projects the behalf of non-anymore-active-developers and with the permission of the Staffs both on STEX and LEX. Current projects: SimcityPolska Restoration and WMP (WorkingManProduction) Restoration.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    5 hours ago, Tyberius06 said:

    So, @Kel9509, @CorinaMarie please tell me what to update or send me a modified LUA that I can put into the DAT and replace the old one with it. I am all for adding and covering more functionality to BSC Essentials. 

    2 hours ago, Kel9509 said:

    So my concern that Opera House tracking needed to be done within the BSC Essentials was mistaken.

    It was long believed that Lua updates of this nature had to be edited into the original Maxis files. Then Null showed us that there are two different GIDs for Lua and inserting into the existing tracking table could be done separately.

    So, afaik, we don't need a BSC Essentials update for them for now.

     

    2 hours ago, Kel9509 said:

    One thing that might be worthwhile to consider is adding tracking for all building types that aren't currently tracked, but that was not my intention in doing this.

    2 minutes ago, Tyberius06 said:

    If you, @CorinaMarie or anybody can get that for me in a copy/paste way, I would add them to the BSC Essentials, so that would be done once and for all.

    It's not something I could put together anytime soon enough. *:blush: 

    I agree with Kel that extra tracking could be a good thing, but let's not rely on me in the next several months. (My RL struggles might improve in a year so hopefully I could then be much more involved than I have been since 2022.)

    • Like 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


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

    I agree with Kel that extra tracking could be a good thing, but let's not rely on me in the next several months. (My RL struggles might improve in a year so hopefully I could then be much more involved than I have been since 2022.)

    I will try to help @Tyberius06 out with this once I'm done with this series of replacement queries.  It makes sense to track everything in case it's needed for the future, especially in one place instead of separate mods.  For the replacement queries, I'm nearly done, just one more item to work on.  I hope to release it tonight or tomorrow.  I had a lot of error-checking and bug-checking done yesterday - primarily involving the budget numbers.  

    I've decided to create overrides for Torocca's/ModPacc Zero's Opera House query with sliders, as well as RippleJet's Private Schools with sliders.  Those are working fine.  The documentation for this mod might be a bit comprehensive (I cannot even begin to think of how I'm going to add this to sc4pac eventually... I'm going to need some heavy hand holding on that one with the metadata creation) and I'm trying to write everything up so that modders or others can take what I've done if they want to use it for their own creations.

     

    • Like 2

    Share this post


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

    Working on some BSC overrides now.  Most are pretty easy as I'm doing obvious ones that are clearly parks, or landmarks, or universities, etc.  Some of these I'm not exactly able to 100% test in game because I don't have the lots or even know what lots they apply to, but the work shouldn't require testing everything since the base templates were all tested.

    SimGoober had a lighthouse query that I thought I could make work using my base Lighthouse template.  The only problem is that his name was part if the image that the query separates into 9 separate pieces to build the background, and stretching the query meant that part of his large name on the bottom part of the image would be replicated elsewhere.  Here's how it'd look in the UI preview:

    6998037facd70_BSC0xb5173999(SimGooberLighthouse).txt-UIEditor2_20_20261_42_37AM.jpg.aa2d1d899479df75e13312b441611792.jpg

    Notice how the "R" of SimGoober is repeated twice on the bottom?  I could probably put my logo on top of both of those but a better idea would be to hide the R if I could with a color box, similar to the color boxes used in my Dept of Transportation query to show the Traffic Volumes.  So I extracted the background image from the BSC Essentials, loaded it up in GIMP, selected the appropriate color of the image to get the R,G,B values, and then made a WinFlatReact box with those values as the fillcolor along with the colorleft, colorright, colortop and colorbottom values for the box itself.  The result?

    6998043054880_SimCity42_20_20261_41_45AM.jpg.35e6f6f6932fba50711972661761dc4e.jpg

    Totally hidden by the opaque box that's the same color as Simgoober's query image.

    @Tyberius06 each BSC override will be its own separate DAT file.  I think that's the best way to do an override, so it can easily be removed if needed.  There's not much, only about 25 of them or so, since I'm only doing the extremely easy and obvious ones.

    • Like 1

    Share this post


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

    each BSC override will be its own separate DAT file.  I think that's the best way to do an override, so it can easily be removed if needed.  There's not much, only about 25 of them or so, since I'm only doing the extremely easy and obvious ones.

    Hm... the general BSC overrides are ok, I suppose, but with the SG query overrides you might have stepped into a mindfield. In the past month I completely disassembled the BSC Essentials and took out all the SimGoober related queries to clean them up from duplicates (like when same background UI image would be included with different uploads under different IIDs, but the image was still the same), and for example the lighthouse UI was one of them. Originally the Lighthouse UI uses background PNG with an IID of 0xb5173999. This same PNG image is used by the MerchandiseMart, but the ID in that is 0xc35c5151. Originally I kept the PNG from the MerchandiseMart, and changed the ID in the lighthouse UI, but then I went further and the lighthouse UI got a similar blue background but with the older Simgoober/BSC logo which was originally in the Mitchell Building. However even this PNG was changed as the original was a big rectangle and the size of it got reduced to a normal small size, which is more easy to stretch... See the image below about this evolution.

    Evolution of SG queries pt.01.jpg

    Over the weekend I compile a small package with the updated SG queries, so you can take a look. 

    • Like 2

    I'm responsible for the Heretic uploads a.k.a. Heretic Projects, you may find updates about my ongoing projects into my development thread over at SimCity 4 DevotionTyberius Lotting Experiments or here on Simtropolis into the Tyberius (Heretic Projects) Lotting and Modding Experiments OR Show Us What You're Working On thread.

    Now I'm part of the NAM Team and the RTMT Team.
    I'm also working on some preservation and reorganization projects the behalf of non-anymore-active-developers and with the permission of the Staffs both on STEX and LEX. Current projects: SimcityPolska Restoration and WMP (WorkingManProduction) Restoration.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    9 hours ago, Kel9509 said:

    Some of these I'm not exactly able to 100% test in game ...

    Just grab any ploppable lot, such as the Big Ben Landmark, and edit its Query exemplar GUID from 0x2A56675C to whatever IID matches the UI you are working on. *;) 

    • Like 2

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


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

    Is there a way to add the local power plant's current "Age Degradation" value to a custom UI query? (I already know about the Ctrl+Alt+Shift query that came with the Extra Cheats DLL). I did try the variable "game.l_power_plant_age_h", but it seems to display that value for all power plants instead of the specific one. (Like two different plants with different Age Degradation/Hard Failure Threshold Values combos will display the same value). The other one, the variable "game.l_power_plant_age_h_subject" doesn't seem to work at all though.

    Share this post


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

    Is there a way to add the local power plant's current "Age Degradation" value to a custom UI query? (I already know about the Ctrl+Alt+Shift query that came with the Extra Cheats DLL). I did try the variable "game.l_power_plant_age_h", but it seems to display that value for all power plants instead of the specific one. (Like two different plants with different Age Degradation/Hard Failure Threshold Values combos will display the same value). The other one, the variable "game.l_power_plant_age_h_subject" doesn't seem to work at all though.

    I haven't tried any of the power plant variables yet, mainly because I had little interest in it while things like AMPS and other power-plant mods were under current development.  

    That said, have you tried any of the variables in a new power plant query?  The "subject" variable is a command for the camera jump or other command to select the current building.  It doesn't display any data itself.  I'm surprised that "game.l_power_plant_age_h" wouldn't work, but in my experience it wouldn't be the first time a variable did nothing.  That can happen.

    When you say you want to display the "Age Degradation" value - what building exemplar value are you specifically referring to?  "0xEA1CF220"?  Is that what you want?  Have you tried using the Lua function to read exemplar values in the Query Tool UI extensions?  I haven't had to do that myself but hopefully it will work for you.

    • Like 1

    Share this post


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

    Originally the Lighthouse UI uses background PNG with an IID of 0xb5173999. This same PNG image is used by the MerchandiseMart, but the ID in that is 0xc35c5151. Originally I kept the PNG from the MerchandiseMart, and changed the ID in the lighthouse UI, but then I went further and the lighthouse UI got a similar blue background but with the older Simgoober/BSC logo which was originally in the Mitchell Building. However even this PNG was changed as the original was a big rectangle and the size of it got reduced to a normal small size, which is more easy to stretch

    Yikes.  I had no idea there was so much overlap and change.  I was indeed using 0xb5173999 as the referenced image, without the BSC logo.  I basically went through the entire BSC Essentials file and looked for landmarks/rewards/parks that mirror the standard Maxis queries, in order to convert them to this larger override.  I found about 25 of them.  There were many more custom queries which I would never touch since it would be way too much work, especially among SimGoober's.  This was actually the only SimGoober-branded query I was working on.  The rest were more generic, either a few standard BSC Logos for Parks (with green, or an orange/white query), CAS one for Parks and Landmarks, some bright Orange queries that have Winnie the Pooh in the left-corner, a purple park query, etc.  

    In fact, here's my list of exported UIs, with the IID in the name and my extremely crude description in parenthesis:

    Quote

    BSC 0xca200038 (X Purple Landmark).txt
    BSC 0xca530008 (CAS landmark).txt
    BSC 0xca530014 (CAS University).txt
    BSC 0xca530023 (BSC Parks CAS Park1).txt
    BSC 0xedbcc99e (BSC University1).txt
    BSC 0xedbcd00b (BRT Blue Park2).txt
    BSC 0x0f1ba3e7 (University).txt
    BSC 0x4de02006 (Dark Green Park1).txt
    BSC 0x6fcac134 (BSC Park2).txt
    BSC 0x7a60000a (Cruise Ship Port).txt
    BSC 0x7a600009 (BSC Park1).txt
    BSC 0x15addda9 (BSC Nut Squad Park1).txt
    BSC 0x105afa4e (BSC White Park1).txt
    BSC 0x910faa45 (Church).txt
    BSC 0x2994f194 (Purple Park).txt
    BSC 0xb5173999 (SimGoober Lighthouse).txt
    BSC 0xbea00006 (Orange Park).txt
    BSC 0xbea00007 (Orange Courthouse).txt
    BSC 0xbea00009 (Orange University).txt
    BSC 0xca200008 (X Landmark).txt
    BSC 0xca200014 (X University).txt
    BSC 0xca200023 (X Park1).txt
    BSC 0xbea00011 (BSC Main Library).txt
    BSC 0xbea00008 (Orange TV Station).tx

    I guess a question is - is it really a problem that there is a bit of overlap on the Simgoober images?  I can understand the frustration of seeing the same image, but with a different IID.  It doesn't seem like it's actively harming anything though, unless you are certain that the image should've been replaced with a newer version.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    1 hour ago, nic49548 said:

    I did try the variable "game.l_power_plant_age_h", but it seems to display that value for all power plants instead of the specific one.

    16 minutes ago, Kel9509 said:

    I'm surprised that "game.l_power_plant_age_h" wouldn't work, but in my experience it wouldn't be the first time a variable did nothing.

    The _h on the end tells us this variable contains the highest value in that city tile (and since it's in years, the oldest power plant). It does work exactly as intended. That variable is checked twice in Lua 0xFF1D93C8. You can look for:

    • a.trigger  = "game.l_power_plant_age_h > 91"

    • a.trigger  = "game.l_power_plant_age_h > 75"

    And each of those are associated with popup messages. *;) 


    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


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

    The _h on the end tells us this variable contains the highest value in that city tile (and since it's in years, the oldest power plant). It does work exactly as intended.

    You're right, I completely forgot about that.  I did the exact same thing to show the highest congestion levels for rails, streets, etc. 

    If @nic49548 can extract the value of the 0xEA1CF220 property, it might work.  But I have no idea what format it'd be in or how it'd look.

    Share this post


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

    The "Age Degradation" value was dependent on two exemplar entries: Age degradation rate and hard failure threshold. It is displayed as a percentage, with two decimal places (E.g. 87.03%) Unfortunately, when I try other variables in null_45's Lua extensions and query hooks UI entry DLLs, it displays the base value, not the current value. (E.g. flammability, it displays the value listed in the building exemplar rather than the current value based off of other multipliers like abandonment, summer or state of being watered)

    • Like 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