Jump to content

7 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Cori's Guide to Displaying Fancy Game Variables
by CorinaMarie

 

Intro

In this tutorial we will learn how to do some quick editing to display internal variables which are now available when using @Null 45's DLLs.

At a minimum, you'll want to install:

Also you'll need to insure the file we create here loads after any other override for the Maxis Coal Power Plant and the Power Query UI. (I'm using them for our demo.)

See here if you need to learn about load orders:

 

Getting Started

After installing the aforementioned DLLs, you'll also need Reader 0.9.3.

I will assume y'all have a wee bit of familiarity with Reader, but hopefully this'll still be clear enough if not. Our goal is a quick down and dirty bit of editing to allow us to see the newly revealed internal Age Degradation variable. (Second paragraph here and my pic in the next post there.)

I'll number these as steps to correspond to the pic numbers and that can help if there are comments or questions.

Edit: I just noticed Null released an update to the Query Tool UI Extensions DLL (see version 2.6.3 details) and that simplifies the code in my Steps 25, 31, 36, and 38. Feel free to use his cleaner method, or continue with this tutorial as-is. It will still work exactly as intended. *;) 

 

Step 01

In Reader, open simcity_1.dat

Single click on any exemplar to activate the Navigator button.

Click said Navigator button, expand the Power tree, then the Lots tree, and right click on the Maxis Coal Power Plant:

01 - Select Group Add Coal Power Plant to Patch from Navigator.png

Then click on Group Add to patch.

 

Step 02

That will pop up this dialog box:

02 - Group Add Popup Screen.jpg

^ Click OK.

 

Step 03

Close Navigator, then click on the Patch button. Next control-click the top Exemplar, the TRK file, and the PNG file entries.

Then click the Remove button.

03 - Control Click Unwanted Items.jpg

 

Step 04

Here we see we still have the Building Exemplar, two LText entries, and the UI file.

04 - Ready to Create DAT.jpg

^ Click Create DAT.

 

Step 05

Name it whatever you want. I went with: Age Degradation UI Display v0.01 by Cori.dat

Like so:

05 - Save as v0.01.jpg

^ Then click the Save button.

 

Step 06

I personally close Reader then reload it. My idea is that clears up the memory that was in use for the big file. Anyhow, we next open the .dat file we just created. On my system there seems to be a weird bug such that the pre-highlighted Exemplar doesn't display the data for its properties.

06 - Initial Open in Reader.png

 

Step 07

So, I click on some other entry:

07 - Click LTExt to Cause Internal Update.jpg

 

Step 08

Then click back on the Exemplar and it'll populate the fields:

08 - Back to Exemplar Which Now Shows Data.png

 

Step 09

This is an interim step which will later show us we are referencing the correct exemplar once we get into the game.

09 - Edit Exemplar Name.png

^ Double click the Exemplar Name in the right-hand panel.

 

Step 10

That'll pop up this dialog box:

10 - After Double Clicking Exemplar Name.jpg

 

Step 11

Rename it to something else which you will later recognize as your own text:

11 - Edited to New Name - Ready to Apply 2nd Time.jpg

^ Click the bottom Apply button after editing in place or if editing in the "Value as text" box, first click the other Apply (which is like a Set button) and then the final Apply.

 

Preparing for Later LUA Coding

Step 12

We'll go ahead and get this ready in case anyone would later like a Part Two of this tutorial which shows how to do data formatting (such as showing a specified number of decimal places). *;) 

Right-click on the first LText entry, then click Generate new instance.

12 - Generate New IID for Top LText.png

 

Step 13

Notice how the IID has changed to some other hexadecimal number:

13 - Showing new IID.jpg

 

Step 14

While that LText entry is highlighted, click the File Info button.

Then click Edit:

14 - Click File Info.jpg

 

Step 15

Here's what it'll look like with the exception that your "Instance" number will be different.

15 - Edit Type and Group to Lua IDs.jpg

 

Step 16

Edit both the Type and the Group numbers to be ca63e2a3 and 4a5e8ef6 respectively.

16 - Click Edit (on File Info Popup).jpg

^ And click OK.

 

Step 17

Notice it still says LText and also still shows the old T and G numbers?

17 - Notice No Visible Update.jpg

 

Step 18

Click a different entry, then click back on the LText we are working with.

Notice it now updates both the Type and the Group numbers. It does not, however, recognize the category change.

18 - Click Exemplar Then Back to LText to See Updated TG IDs.jpg

 

Step 19

So, click to save the file and yes, we are happy to overwrite our existing one.

19 - Save and Overwrite.jpg

 

Step 20

Close the file then re-open it and notice how it properly recognizes this as a LUA entry. *:) 

20 - Close Then Reopen File to See LUA Entry.jpg

 

Step 21

Single-click the LUA file entry. We are going to put some placeholder Lua code in here.

21 - Click on LUA Entry.jpg

^ Click the Edit button in the right-hand panel, highlight the existing text, and paste the following right on top of it:

--#-package:03092f5a# -- package signature --
-- For Lua file entry IID 0xf3092f5a


--EOF

 

Step 22

Notice the two hexadecimal numbers. The 2nd one needs to be edited to match the IID you generated in Step 12 (and seen in Step 13). Then the package ID will be the very same number, but replace the first hex digit with a 0.

(Note: Any package signature number greater than 0x7FFFFFFF will not be recognized by the game. Only positive integers are allowed when it converts those to decimal.)

22 - Edit LUA Entry.jpg

^ Click the Apply button when you are finished editing.

 

Back to the Main Part

Step 23

Right-click the remaining LText entry and select Generate new group & instance.

23 - Next LText Generat New G and I.png

 

Step 24

Notice that both the Group and Instance numbers are now different.

24 - Show New G and I of LText.jpg

 

Step 25

Paste this over the existing text:

#null45_query_ui_extensions.get_property_value(hex2dec('00000020'))#

Edit: The Query Tool UI Extensions DLL was updated to v2.6.3 at the same time I was gathering pics and writing this tutorial. As such, I've shown the method which was in effect via v2.6.2. Fortunately both code methods will still work. If you have v2.6.3 or later, you can use the following code instead. (I'm not going to update the picture.)

#null45_query_ui_extensions.get_property_value('00000020')#

Note: The # on each end of the code makes this a Token which means the UI will display the value it produces rather than the code itself.

Also Note: It needs pasted from the right-click menu. For some reason Ctrl+V is not allowed.

25 - Paste in Exemplar Display Code.jpg

^ Then click the Apply button.

 

Step 26

This'll be the down and dirty part in which we are just going to steal a spot in the UI to display our data (rather than expanding it nicely like @Kel9509 does).

Right-click on the UI file entry and select Text View.

26 - Select Text View for UI.png

 

Step 27

I have Reader smaller than I typically do for editing so the pics here can be smaller. As such I have to scroll the right-hand panel a wee bit. What we are looking for is the line where the word Efficiency is displayed. We are going to replace ea5524eb,8a5ba2a7 with the values we created in Step 24.

27 - Find Captionres of Efficiency Label.png

 

Step 28

Mine are 4721f708,820e0172 so that's what I paste in. Be sure to use your own T & G as generated in Step 24.

28 - Update to New G and I.png

^ Click the Apply button.

 

Step 29

Now we save the whole file again and yes, we are happy to overwrite.

29 - Save Again.jpg

 

Step 30

Finally the fun part! *:)

Load the game and plop a Coal Power Plant then Query it.

30 - Show Power Plant Display in Game.jpg

^ You should see whatever text you used in Step 11.

This was a mini goal which shows we've correctly edited the UI to use our own unique LText and the proper code to access the data provided by Null's DLL. *:) 

 

Step 31

Remember the linked post above?

We are now ready to use that 0xc910b4cf which Null tracked down to display the Age Degradation of the Queried Power Plant.

Re-edit the LText to be: #null45_query_ui_extensions.get_property_value(hex2dec('c910b4cf'))#

Edit: The Query Tool UI Extensions DLL was updated to v2.6.3 at the same time I was gathering pics and writing this tutorial. As such, I've shown the method which was in effect via v2.6.2. Fortunately both code methods will still work. If you have v2.6.3 or later, you can use the following code instead. (I'm not going to update the picture.)

#null45_query_ui_extensions.get_property_value('c910b4cf')#

31 - Revise to Show Internal Age Degradation.jpg

^ And then click Apply.

 

Step 32

Let's now do a Save as...

32 - File - Save As.jpg

 

Step 33

Increment your version number while leaving all the rest of the file name the same.

This will cause the 2nd version to load later than your first one and so we don't need to clean out our folder just yet.

33 - Save as v0.02.jpg

 

Step 34

We go in the game, plop a Coal Plant, query it, and we see the Efficiency word instead of any data. :O 

34 - Initial Plop in Game - Efficiency Showing.jpg

^ Close the query and run time till the next month.

 

Step 35

Now when we query, we see a zero.

This tells us that the value retrieved was nil when we first plopped the power plant, but that it updated to a numeric response after running time.

35 - Run Till 1st of Next Month - Zero Shows.jpg

 

Step 36

Quit the game and let's take care of that nil value borking our code.

Paste in: #null45_query_ui_extensions.get_property_value(hex2dec('c910b4cf')) or 0#

Edit: The Query Tool UI Extensions DLL was updated to v2.6.3 at the same time I was gathering pics and writing this tutorial. As such, I've shown the method which was in effect via v2.6.2. Fortunately both code methods will still work. If you have v2.6.3 or later, you can use the following code instead. (I'm not going to update the picture.)

#null45_query_ui_extensions.get_property_value('c910b4cf') or 0#

36 - Back in Reader - Handle Null Value.jpg

That or 0 part is handy. If the first part doesn't even exist (the nil value) then it makes the answer be zero.

Apply and Save.

 

Step 37

Back in the game and now we have our 0 the moment we plop the power plant. *:golly: 

37 - In Game Initial Plop Show Zero.jpg

(Quit the game again.)

 

Step 38

The other thing going on is Maxis programmed the UI to automatically truncate any decimal portion of numbers displayed and that's very good for things like population. However, we are wanting exact data to be shown. As such, we can fool the UI's hidden code by making our number into a string. The following code will concatenate the middle dot to the end of the number we want to see and then the UI replaces it with a space.

Paste in: #(null45_query_ui_extensions.get_property_value(hex2dec('c910b4cf')) or 0)..string.char(183)#

Edit: The Query Tool UI Extensions DLL was updated to v2.6.3 at the same time I was gathering pics and writing this tutorial. As such, I've shown the method which was in effect via v2.6.2. Fortunately both code methods will still work. If you have v2.6.3 or later, you can use the following code instead. (I'm not going to update the picture.)

#(null45_query_ui_extensions.get_property_value('c910b4cf') or 0)..string.char(183)#

38 - Update Code to Tag on Middle Dot and Force String Type.jpg

Click Apply, then Save the file.

 

Step 39

Back in the game. We already know we get a zero when first plopping so this pic is after running time to the next month.

This shows how a Float32 variable handles the number. *;)

39 - In Game Showing Full Data Value 1st of Month.jpg

 

Step 40

Run another month and check again...

40 - In Game Showing Full Data Value 1st of 2nd Month.jpg

 

Conclusion

That should be enough to get your feet wet. *:D

Special thanks to @Cyclone Boom for following this tutorial, providing feedback, and for fancy tweaking of the post to make it presentable. :wub:

  • Like 4

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:  
 

Automated Notice Message

All posts after 1 March, 2026 @ 01:37 GMT were lost in the site crash.

We've added this message thread divider in every topic across all forums for what were then active threads. (We decided active is if the most recent extant post (from the backup) was on or after 1 January, 2026.)

This divider serves as notice that the conversation was interrupted. Answers and further discussion which used to be here have been lost. Keep this in mind when replying. Our hope is to rebuild what is missing.


I am Lab Rat.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
On 2/22/2026 at 3:17 PM, CorinaMarie said:

Edit: I just noticed Null released an update to the Query Tool UI Extensions DLL (see version 2.6.3 details) and that simplifies the code in my Steps 25, 31, 36, and 38. Feel free to use his cleaner method, or continue with this tutorial as-is. It will still work exactly as intended. *;)

This method is depreciated due to it only working correctly for hexadecimal values that start with a letter. The code still exists in the DLL, but only to maintain backwards compatibility with existing mods that may be in the wild. I updated the Lua Extensions DLL to officially depreciate it, but I forgot that the Query Tool UI Extensions DLL had similar code.

The issue is that when the C++ side asks Lua 'is this parameter a number', the Lua system will try to convert the string to a decimal number stopping on the first hexadecimal letter. Obviously a hexadecimal string that gets parsed fully or partially as decimal will produce incorrect results.

  • Thanks 1

Share this post


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

This method is depreciated due to it only working correctly for hexadecimal values that start with a letter. The code still exists in the DLL, but only to maintain backwards compatibility with existing mods that may be in the wild. I updated the Lua Extensions DLL to officially depreciate it, but I forgot that the Query Tool UI Extensions DLL had similar code.

I saw when you did this and unfortunately this is a devastating setback.  I don't know if there's any way around this issue.  It's a real shame though.  

Share this post


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

I don't know if there's any way around this issue.

I don't think there is, AFAIK automatic type conversion is a basic feature of the Lua language. The fix is to convert hexadecimal strings to numbers using the hex2dec function before passing them to any function that requires them, same as what Maxis code was already doing.

I was surprised by the automatic type conversion myself, but I confirmed it in the debugger on the C++ side. I only learned about the issue after a user reported they were getting errors due to the bad type conversion. I am not sure why I never ran into it myself earlier, possibly because many of my test values had a letter as the first character which would prevent the incorrect detection of a decimal number. If I had known about the possibility of Lua performing an automatic conversion of a string to a number, I would have never added the hexadecimal string code.

  • Like 2

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    16 hours ago, Null 45 said:

    If I had known about the possibility of Lua performing an automatic conversion of a string to a number, I would have never added the hexadecimal string code.

    So in this case my tutorial is good as it stands? Just needing the missing images restored. (Which I have available, but there are bigger fish to fry in RL for now.)


    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:  
     
    15 minutes ago, CorinaMarie said:

    So in this case my tutorial is good as it stands?

    Yes, as it uses hex2dec.

    The edits mentioning the string parsing could be removed, but that can be done whenever you have the time to restore the images. :)

    • 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