Automatic save of world file

Posted by Nick Gammon on Tue 24 Jun 2008 12:26 AM — 1 posts, 7,872 views.

Australia Forum Administrator #0
The timer below will automatically save your world file every 3 minutes, if you have changed it.

This is helpful if you are making all sorts of improvements to triggers etc., but are so carried away by what you are doing you forget to save anything.


<timers>
  <timer name="autosave" enabled="y" 
    minute="3" second="0.00" offset_second="0.00"    
    active_closed="y"
    send_to="12"
    omit_from_output="y" >
  <send>

if GetInfo (111) then
  Save ()
  ColourNote ("white", "blue", "World file saved.")
end -- if world file changed

</send>

  </timer>
</timers>


This is in Lua, it will work as is if you are using Lua scripting, otherwise turn it into a plugin, and install that:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, June 24, 2008, 10:23 AM -->
<!-- MuClient version 4.29 -->

<!-- Plugin "Auto_Save" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Auto_Save"
   author="Nick Gammon"
   id="8238deec7c06bade8ebc3819"
   language="Lua"
   purpose="Automatically saves the world every 3 minutes"
   date_written="2008-06-24 10:23:08"
   requires="4.29"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Saves the world file every 3 minutes, if it has changed.
]]>
</description>

</plugin>


<!--  Timers  -->

<timers>
  <timer 
    name="autosave"   
    enabled="y" 
    minute="3" 
    second="0.00" 
    offset_second="0.00"    
    send_to="12"
    omit_from_output="y" 
    active_closed="y"
    >
  <send>
  
if GetInfo (111) then
  Save ()
  ColourNote ("white", "blue", "World file saved.")
end -- if world file changed

</send>

  </timer>
</timers>

<script>
assert (GetOption ("enable_timers") == 1, "Timers not enabled")
</script>

</muclient>