Preventing save.

Posted by Poromenos on Wed 26 Oct 2005 12:20 AM — 8 posts, 31,880 views.

Greece #0
Right now, MUSHclient saves my worlds (I have set it to save on close) even though nothing has changed. This changes the dates and messes up my repository (I keep the files in an SVN repository to update between clients easily). Is there a way I can prevent this, or can an option be implemented to not save if nothing has changed (or follow the option that already exists if only variables have changed). It is far more important for me to not get a message box asking me to save than getting dates changed, though.
Australia Forum Administrator #1
The auto-save only saves if it thinks the world is modified. See:

http://www.gammon.com.au/scripts/doc.php?function=GetInfo

You can do a GetInfo (111) to see if this flag is set, and by doing it from time-to-time see when it was set.
Greece #2
Hmm, you're right. It doesn't seem to always save the world, but I did a diff on a world that has changed and all that changed was the dates. What's up with that? I can't see why it would save with nothing changing.
Australia Forum Administrator #3
Well it doesn't keep an entire copy of the "before" and "after" and compare them at the last moment. What it does is set a "document is modified" flag whenever it thinks you have changed something (eg. modified a trigger). It tries to be smart and compare the before and after of each field, even if you just look at a trigger and click OK.

However if you change something, eg. the note colour from blue to green, and then (later) from green back to blue, that counts as 2 changes, not zero changes, even though the net effect is that the colour is back to how it was.

There is possibly a bug in MUSHclient, or possibly you are changing things that don't really count (eg. in a plugin). I think a while ago there was a bug where changes (eg. to triggers) in plugins counted as changes when they weren't really a change to the main document.

In fact, a quick browse of the code seems to indicate that is still a problem. Can you isolate it down a bit? By checking GetInfo (111) can you confirm that the problem crops up (ie. the world modified flag is set) after you do something like add a trigger in a plugin?
Greece #4
I'll try. I'm not the type to look at a trigger and press OK, I always press cancel everywhere unless I need to save the changes. I'll do GetInfo from time to time and keep you posted.

Also, I meant that the flag should have been set only if something changed, and I'm not usually reverting the changes I made in a world, so MUSHclient must be setting it erroneously. Not even the variables are changing.
Amended on Wed 26 Oct 2005 11:13 PM by Poromenos
Australia Forum Administrator #5
Something like this (this is in Lua) that will notify you shortly after the document becomes changed. This is simple and doesn't keep a flag to stop doing it multiple times, you would need to disable the timer after the message appears.


<timers>
  <timer enabled="y" second="10.00"    send_to="12"
>
  <send>if GetInfo (111) ~= 0 then
  ColourNote ("white", "red", "Document has changed")
end</send>

  </timer>
</timers>

Australia Forum Administrator #6
I think it is one of these 4 routines:

AddAlias
AddTrigger
AddTriggerEx
EnableTrigger

They were not checking to see if they were executing in a plugin, the other ones were (eg. DeleteTrigger and so on).
Greece #7
Yep, it's EnableTrigger. My plugins make heavy use of this and it results in the world getting saved.