• Welcome to SC4 Devotion Forum Archives.

DLL-modding for Hotkeys - AutoSave & AutoHistorical

Started by CasperVg, September 06, 2019, 02:47:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CasperVg

I've recently found that, by combining simmaster07's excellent work on gzcom-dll and ebina's work on KEYCFG modding in 2009 - we can actually use DLL plugins to create new programming functions that are triggered by hotkeys.

So far, what we can actually do within those functions is still somewhat limited by the classes that simmaster07 decoded, but a number of things that I have been able to do:

- Assign a hotkey that automatically adds/removes $100k to your city budget each time it is pressed
  * Uses cISC4BudgetSimulator
- Assign hotkeys to automatically make all lots in a city historical, or to stop all lots in a city from being historical, or to toggle historical status of all lots in the city.
  * Uses cISC4LotManager and cISC4Lot
  * sim_16 has recently managed something similar over on Simtropolis, but his solution requires savegame editing - which means you need a separate tool and need to close to game.

The hotkeys I have added are as following:

  • Ctrl + B + Numpad+  -->  Add $100k to budget
  • Ctrl + B + Numpad-  -->  Remove $100k from budget
  • Ctrl + H  -->  Make all lots in the city historical (shows a confirmation dialog first)
  • Ctrl + Alt + H  -->  Make all lots in the city non-historical (shows a confirmation dialog first)
  • Ctrl + Alt + Shift + H  -->  Toggle historical status of all lots in the city (historical becomes non-historical and non-historical becomes historical) (shows a confirmation dialog first)

For good measure I have also added an extra cheatcode: AutoHistorical.
When this cheat code is activated, the game will automatically mark all lots as historical every 1st day of the Month. To disable it, just enter it again.

To test what I have so far:
1. Download the ZIP file in the attachment
2. Move the files CAS_AutoHistorical_v0.0.1.dat and CAS_AutoHistorical_v0.0.1.dll to your plugin folder root.

If you have suggestions on other things you would like hotkeys for, let me know in the comments  ;)

EDIT: Attachment removed. A newer version is available here
Follow my SimCity 4 Let's play on YouTube

metarvo

This is one of those things I didn't even consider until I saw it... but now I can see the potential.  Certain types of city-building styles benefit greatly from historic status.  For instance, I could imagine it would work wonders for diagonal residential neighborhoods when one has taken the time to grow a row of houses just so.

Nice work, Casper! :thumbsup:
Find my power line BAT thread here.
Check out the Noro Cooperative.  What are you waiting for?  It even has electricity.
Want more? Try here.  For even more electrical goodies, look here.
Here are some rural power lines.


Andreas

This is rather intriguing alright! You guys never cease to amaze me, impressive what you can do with such an old game. I wonder if you could create a hotkey for "fixing" the "water graphics bug" that always occurs when using lots with no base texture, and you switch to underground view and back.
Andreas

Tyberius06

Casper, these are really awesome developments! The make things historical hotkey and cheat alread my favoutire, since my gameplay is heavily depending on certain buildings to grow next to each other and I only want to keep certain buildings.
I don't know if the +1 reputation option is still available with the new SC4D, but I would like to give you +1 for this development.

- Tyberius
You may find updates about my ongoing projects into my development thread here at SimCity 4 Devotion: Tyberius Lotting Experiments
or over there on Simtropolis into the Tyberius (Heretic Projects) Lotting and Modding Experiments.
I'm also member of the STEX Custodian and working on different restoration projects on behalf of non-anymore-active custom content creators.
Current projects: WMP Restoration and SimCity Polska Restoration.
Member of the NAM Team and RTMT Team.

mattb325

Wow, this is excellent stuff indeed, Casper!
It's these sorts of amazing new findings that will really help keep this old game alive.  :thumbsup:

mgb204

Quote from: Tyberius06 on September 06, 2019, 01:51:19 PM
I don't know if the +1 reputation option is still available with the new SC4D, but I would like to give you +1 for this development.

Done!

CasperVg

    Hi all, thanks for the positive response and K-point Tibi/mgb!@metarvo: Indeed that was one of the use cases I had in mind, along with people who like to grow thematic neighbourhoods and then want to keep them intact (like Tyberius mentioned).@alejogc13: I'm not very familiar with alpha blending (or the rendering of models in game in general). There is a RenderProperty called "ForceNoAlphaBlend" currently in the game, which can be activated from the command line, I believe. However, the opposite (ForceAlphaBlend) is not available - but I would presume the game defaults to using alpha blend? Do you know in which cases it doesnt?@Andreas: Might be possible to hack a hotkey in that switches to the zone data view and then back to the normal view successively. IIRC switching to the zone data view is the current workaround, right? I don't think those methods/classes have been decoded yet, however - so it might take some time.I come to you today with v0.0.2 of the mod. It contains one bugfix and one new feature.- Bugfix: I accidentally included an experimental KEYCFG, which meant that the Road hotkey (R) no longer worked with it installed. v0.0.2 reverts to the default configuration, with only hotkeys added and none changed.- Feature: AutosaveAutosaving functionality used to be requested a lot to reduce the impact of those pesky CTDs. However, since simmaster07's SC4Fix solved the most common source of CTDs (puzzlepiece-over-TE), it has become not as critical. However, it now exists anyway :DThe new functionality in detail:
      • New cheatcode: AutoSave <x> --> Enables/disables autoquicksave.
        • If you enter no argument ([tt]AutoSave[/tt]) it will simply toggle the autoquicksave on or off, the default value is 1 (quicksave every game month).
          • If a numeric value is entered after the cheat code, this will be used as the interval between autoquicksaves (in months).
          • e.g. [tt]AutoSave 1[/tt] automatically quicksaves the game every month (at the end of the month)
          • e.g. [tt]AutoSave 12[/tt] automatically quicksaves the game every year (at the end of the game month when the cheat was entered)
        • New hotkey: Ctrl + Shift + Alt + S --> Enables/disables autoquicksave
      Note:To reduce saving time and to avoid the pesky 'City has been saved'-dialog, this DLL uses the games' QuickSave routine. This is quite a bit quicker (though still significant on large, built-up cities). It does, however, not update the city preview images for the region view. So it's still advised to do a full save when you quit the game, so that those previews are updated.Note:Because the auto saving routine is triggered by game time (and not IRL time), it doesn't work if your game is paused. I will explore in the future if there is some way to trigger it via real time as well.Please find v0.0.2 in the attachment. Just replace the existing .dat and .dll files with the new ones to update.
    [/li]
Follow my SimCity 4 Let's play on YouTube

AsimPika3172

I loves Sim City forever!

Shiftred

This is great! In just a few minutes it has proven to make my play style much easier.