Jump to content
SimQuestria

Hello, I'm (Somewhat) New - Custom Content Questions

42 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
Currently: Viewing Forums Index
 
6 hours ago, twalsh102 said:

When you get the chance to look at the LUA again, if you could also take a look at the UI and make sure I'm not missing something important.

I've now had said chance and no, you aren't directly missing something. *;)

 

Here's how it works:

In the game when you have the Census Repository screen open and hover your mouse over any of the three TAX column header words, a tool tip pops up with verbiage. The last line is the part that claims to know the neutral tax rate:

7010-0877.jpg

 

For ease of exploring the UI, this is where Reader 1.5.4 shines. Find the UI entry in the left pane, then click the TAX label in the right side display:

7010-0878.jpg

^ Here we are looking for two things. First is the captionres which shows {8BFCA741,5827601A} and the second hex value is the one we want to know. Also, then that tips is set to True.


So, just showing what that 5827601A is pointing to:

7010-0879.jpg

^ And that's how it knows to put the word TAX exactly where the other info tells it to.

 

Now, here comes the tricky part. Do some hex math: 0x5827601A + 0x400 = 0x5827641A and now we know where to look for the text which is displayed in the tool tip hover over:

7010-0880.jpg

^ In text anything between # symbols designates a variable which can be Maxis defined or user defined via the LUA code.

 

That #RJCR_NeutralTax()# then corresponds to this part of the LUA code where it is defined:

7010-0881.jpg

 

For me to continue I need whatever .dat file in CAM defines the altered Neutral Tax rate. Since the CAM requires installation and I don't use it, I'm not personally going to go tracking that down, but if you'll attach the .dat file I need, I can explore this further to rewrite that function.

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

@CorinaMarie,

AHA, the two parts I missed were tooltips set to true, and then the hex math.  How does one know to add 0x400 to find the text for a tooltip?  Is that universal?

The .dat file is the one you added to the download page for CAM.  If you look at it with DataNode, you'll be able to see it in plain English (as opposed to the way Reader displays it) (Might be easiest to use an empty Plugins, but it isn't necessary).  Once you've scanned your Plugins, switch to TGI View and click on Simulation.  This will show all of the Maxis Simulation-related exemplars as well as the CAM overrides for same.  You're looking for the Demand Simulator Exemplar IID 4A1F3CE6.  The Maxis default version and the CAM version will show up one above the other in the list of Exemplars, differentiated by file path. 

  • Thanks 1

Share this post


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

How does one know to add 0x400 to find the text for a tooltip?  Is that universal?

To be honest, I really don't know. *:blush: Each one I checked was exactly 0x400 more than the underlying display text so I inferred that's the rule and since it's a similar concept to how textures work with only needing to list one and the game figures out all the other zooms it does seem likely it might be universal. YMMV, ofc. *;)

 

6 minutes ago, twalsh102 said:

The .dat file is the one you added to the download page for CAM

Prolly about the same time you were typing that, it occurred to me that'd be the most likely place for it and I'd just found it when you beeped me. *:)

7010-0882.jpg

 

I'm real comfy in Reader and I can see exactly what's going on there. I can certainly rewrite the Census Repository function to use that table and one would simply replace the RJ - Census_Repository_Model_and_Query_3.1.dat file for it to take effect. It might be I can reference those exact variables and then make it universal. I'll do the easy version first and y'all can then test it.

  • 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:  
Currently: Viewing Forums Index
 

Revised: See my post below.

Ok, here's the test version:

Remove the existing: RJ - Census_Repository_Model_and_Query_3.1.dat file and replace it with the test file. I have it returning and displaying the Neutral Tax to two decimal places as I feel that's more accurate since it is what is being used internally.

Here's the rewritten function:

7010-0889.jpg

 

Let me know how it goes. *;)


  Edited by CorinaMarie  

Removed file. See later post.
  • 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:  
 

Cool!  Working on something else at the moment, but should be able to get back to you by either later tonight, or tomorrow with test results.

I thought the syntax of the LUA looked familiar, and was going to ask if you were aware of any tutorials.  Then I Googled it and found that LUA is not only a script, but a scripting language based on ANSI C, which I took some courses on a couple of decades ago.  No wonder it looked familiar.  Looks like I may need to go back to school.

  • Like 2

Share this post


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

LUA is not only a script, but a scripting language based on ANSI C

Yeah, knowing C and then LUA is really easy to code.

The only real drawback for the embedded LUA in SC4 is that if anything, and I mean anything, is slightly amiss it'll bounce right out of it. So, if you make any syntax error at all then you've got to find the problem by trial and error.

  • 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:  
Currently: Viewing Forums Index
 

I've tinkered some more and I won't be able to access those properties of the Demand Simulator Neutral Tax Rate directly to know which table to use. However, because RippleJet calculates what to display via a function in the LUA code, I can simply overwrite that one single function while not affecting anything else in his code. The following method is cleaner and doesn't need replacing any of the original three Census Repository files.

I've created two new .dat files. Place one or the other (not both) in the same folder with the Census Repository.

My LUA code in these changes the IID to F86709B5 and the package ID to 7571F58B so there is no conflict with the originals.

 

Here's the code for Maxis complete with what appears to be bugs with duplicate Neutral Tax rates as found in the original Demand Simulator extracted from SimCity_1.dat:

7010-0890.jpg

 

Simply add this file to the Census Repository folder in your Plugins:

7010-0891.jpg

 

Here's the code for the CAM 2.1.0a Neutral Tax rates:

7010-0892.jpg

^ This is the same code as from a few posts up, but now in its own file.

 

And the same for using this one is to place it in the Census Repository in Plugins:

7010-0893.jpg

 

Just remember, use only one or the other of my override files.

Btw, are there any other Demand Simulators out there which alter the Neutral Tax rate? Maybe SPAM? Or a fix for the bugged Maxis one? If so, I can create an override for any of them too.

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

I'm not sure the Maxis one was bugged as much as it had the same Neutral Tax Rate for multiple Population thresholds on purpose.  If it happened only once, it might have been an accident/bug.  To have it happen as many times as it appeared in the Maxis Table, it had to be on purpose. 

Just quickly threw the SPAM mod file into Plugins and scanned with DataNode.  There is no override for the Demand Simulator included with SPAM.  Haven't seen anything else that overrides this particular exemplar, but that doesn't mean there isn't something else out there that does so.  Haven't compared the Demand Simulator from CAM 1.0 with the 2.1.0 version to see if they are the same.  Will try to look at documentation from the 2 versions to see if there is any mention in there once I get back from Breakfast.  Might need to download CAM 1 to see.

  • Thanks 2

Share this post


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

The only real drawback for the embedded LUA in SC4 is that if anything, and I mean anything, is slightly amiss it'll bounce right out of it. So, if you make any syntax error at all then you've got to find the problem by trial and error.

Maybe a LUA code tester would help?

  • Thanks 3

-- Jeff Fisher ><> Vancouver WA
"I may be pissing into the wind, but if I keep my enemies behind me and aim carefully, I can still rain on their parade."

Share this post


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

Maybe a LUA code tester would help?

It might indeed. I tried the Ideone one making a deliberate mistake in the program and it correctly said:

compilation info

luac5.3: prog.lua:51: 'end' expected (to close 'function' at line 8) near <eof>

So, that'll likely be quite helpful. *:yes:

  • 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

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