Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ Suggestions
➜ Plugin Saving behavior
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #15 on Thu 05 Aug 2010 06:19 AM (UTC) |
Message
|
Nick Gammon said:
Twisol said:
At any rate, this should also do it:
do
local old_ss = SaveState
function SaveState()
__SAVE_STATE__ = true
old_ss()
__SAVE_STATE__ = false
end
end
function OnPluginSaveState()
if not __SAVE_STATE__ then return end
-- state saving stuff
end
Just make sure you have save_state="y" or SaveState() still won't do anything.
Ah, no. When MUSHclient saves state, it doesn't redirect back through the Lua glue routines (or the Lua script space).
You're saying that SaveState() doesn't force OnPluginSaveState to be called?? |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #16 on Thu 05 Aug 2010 06:36 AM (UTC) |
Message
| Unless I have misread your intention here, you are replacing the SaveState function. I am saying that the replaced function won't be called when MUSHclient saves the plugin state.
For example, if you replace the ColourNote function, that will affect ColourNote calls in your script, but not if MUSHclient chooses to do a ColourNote itself (eg. on a script error). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #17 on Thu 05 Aug 2010 06:39 AM (UTC) |
Message
| Yeah, but SaveState() isn't called by MUSHclient ever anyways, because it's provided for the user to call. My little hack here provides OnPluginSaveState code a way to tell whether it was invoked from a scripted SaveState() call, or a plugin-removed/world-closed event. When you call this SaveState(), it sets a flag. This way you can only respond to SaveState() calls, and not the closing events. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #18 on Thu 05 Aug 2010 06:48 AM (UTC) |
Message
| Oh, OK. It is like a "note to self" that you are doing a manual save state? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #19 on Thu 05 Aug 2010 06:48 AM (UTC) |
Message
| Yeah, precisely. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #20 on Thu 05 Aug 2010 09:20 PM (UTC) |
Message
| Oh well, I amended it to allow a call to SaveState to save the state even if save_state is not enabled. Personally I think it will cause hassles, but whatever. It should be backwards compatible, excepting possibly those plugins that manually save state without the flag set (at present) will now actually get the state file next time. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
52,879 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top