Menu

LEX File Exchange EA Support Files
SC4 Wikipedia Network Addon Mod
Dependencies Chat

Author Topic: DLL-modding for Hotkeys - AutoSave & AutoHistorical  (Read 1674 times)

0 Members and 1 Guest are viewing this topic.

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2881
  • Reputation: 47
  • CL:
    The Go-To Guy!!
DLL-modding for Hotkeys - AutoSave & AutoHistorical
« on: September 06, 2019, 04:47:31 AM »
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
« Last Edit: September 07, 2019, 10:58:59 AM by CasperVg »
Follow my SimCity 4 Let's play on YouTube

Offline metarvo

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2224
  • Reputation: 9
  • Wired up!
  • CL: Power to the
    people!
Re: DLL-modding for Hotkeys - Automatically mark all lots as historical
« Reply #1 on: September 06, 2019, 07:29:37 AM »
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.


Offline Andreas

  • Administrator
  • Forums Legend
  • *
  • Posts: 4739
  • Reputation: 33
    • SimCityPlaza
  • CL: ()bobby() Transit Controller
Re: DLL-modding for Hotkeys - Automatically mark all lots as historical
« Reply #3 on: September 06, 2019, 01:57:23 PM »
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.

Offline Tyberius06

  • NAM Team
  • Forums Senator
  • *
  • Posts: 736
  • Reputation: 6
  • Your slogan here
Re: DLL-modding for Hotkeys - Automatically mark all lots as historical
« Reply #4 on: September 06, 2019, 03:51:19 PM »
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 OR Show Us What You're Working On thread.
I'm also working on some preservation projects the behalf of non-anymore-active-developpers.

Offline mattb325

  • BSC Team
  • Forums Parliamentarian
  • *
  • Posts: 1602
  • Reputation: 25
  • CL:
    SC4D Housing Authority
Re: DLL-modding for Hotkeys - Automatically mark all lots as historical
« Reply #5 on: September 07, 2019, 01:10:57 AM »
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:

Offline mgb204

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2314
  • Reputation: 23
  • CL:
    Solved!!
Re: DLL-modding for Hotkeys - Automatically mark all lots as historical
« Reply #6 on: September 07, 2019, 04:48:08 AM »
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!

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2881
  • Reputation: 47
  • CL:
    The Go-To Guy!!
DLL-modding for Hotkeys - AutoSave & AutoHistorical
« Reply #7 on: September 07, 2019, 10:57:52 AM »
    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: Autosave
Autosaving 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 :D

The new functionality in detail:
  • New cheatcode: AutoSave <x> --> Enables/disables autoquicksave.
  • If you enter no argument (AutoSave) 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. AutoSave 1 automatically quicksaves the game every month (at the end of the month)
    • e.g. AutoSave 12 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.[/list]
« Last Edit: September 07, 2019, 11:06:10 AM by CasperVg »
Follow my SimCity 4 Let's play on YouTube

Offline AsimPika3172

  • SimPopeye
  • Forums Mayor
  • *
  • Posts: 188
  • Reputation: 0
  • I love Sim City forever!
Re: DLL-modding for Hotkeys - AutoSave & AutoHistorical
« Reply #8 on: September 07, 2019, 05:52:09 PM »
Cool!  :thumbsup: &apls &apls &apls :bnn:
I loves Sim City forever!

Offline Shiftred

  • Forums Councilmember
  • *
  • Posts: 71
  • Reputation: 2
Re: DLL-modding for Hotkeys - AutoSave & AutoHistorical
« Reply #9 on: September 07, 2019, 09:28:39 PM »
This is great! In just a few minutes it has proven to make my play style much easier.

Offline Jasoncw

  • Forums Councilmember
  • *
  • Posts: 97
  • Reputation: 0
Re: DLL-modding for Hotkeys - AutoSave & AutoHistorical
« Reply #10 on: September 13, 2019, 02:34:54 PM »
Incredible!!