The Dink Network

Reply to Re: What's the best way to run a script every time a save is loaded?

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
February 13th 2012, 05:06 AM
fairy.gif
Someone
Peasant He/Him Australia
 
I don't think there is an elegant solution for running scripts after a load, unfortunately. In MouseDink I did this using the disarm() procedure of Dink's equipped weapon, but this was a special case because the only purpose of assigning Dink an equipped weapon script was to run scripts after loading, and the weapon cannot be disarmed by any means.

I don't remember why I used disarm() and not arm()... judging from my scripts and a vague memory disarm() is run after loading but not after equipping the weapon.

While I don't think an elegant solution exists, I think you can probably come up with a working and even unbreakable but ugly solution with enough testing. It is possible that Dink.exe does something unique on loads (running the disarm and then the arm of the same weapon script might be an example). If it does then you can use that to determine if a load has occurred and run the scripts.

Edit: I looked at the DinkC reference, and it confirms disarm() then arm() is run when loading. It also says that armmovie() is called when the player arms the weapon but not on loading a game or if arm_weapon() is used. So it should be possible to add a bit to each weapon (or each magic) script to detect a load has occurred. Not pretty, but does that matter that much anyway?