[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  .mcl too large...?

.mcl too large...?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Meredin   (13 posts)  [Biography] bio
Date Wed 10 May 2006 06:34 PM (UTC)
Message
So I was attempting to make a dynamic stack by using a few triggers and scripts, using a trigger to add to a variable and another to remove from the same variable. Well apparently I forgot to enable the remove trigger, so my variable become rather large. I didn't notice this, and when I clicked save, it locked up my whole computer. Now, when I attempt to open the world, I get this error:

Line 1: XML file "D:\RoD\Brew\Brew-Xardas.MCL"too large - maximum permitted is 1024000 bytes (problem in this file)

I noticed that all the other worlds are around 12-20kb in size, but this one is over 1.3Mb, so I can only imagine what happened. The easy fix is just to recreate the world, but unfortunately he has around 30 triggers, none of which I've ever saved, and I was wondering if there was a way to clear the variables without opening the world, or any other way to get around this? Thanks!
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 10 May 2006 08:39 PM (UTC)

Amended on Wed 10 May 2006 08:41 PM (UTC) by Nick Gammon

Message
Hopefully the file is simply too large, and not actually corrupted. In that case, simply use a text editor that can handle large files, open the .mcl file, and scroll down until you see the line "<variables" and delete it and everything until the line "</variables>". Save under a different name, just in case, and try the new one.

If you don't have such an editor, this small Lua script will do that for the file you specify in the first couple of lines.


oldworld = assert (io.open ("C:\\Smaug.mcl", "r"))  -- open old file for reading
newworld = assert (io.open ("C:\\Smaug_fixed.mcl", "w")) -- open new file for writing
have_vars = false
for line in oldworld:lines () do
  if line == "<variables" then
    have_vars = true
  elseif line == "</variables>" then
    have_vars = false
  else
    if not have_vars then
      newworld:write (line .. "\r\n")
    end -- not inside <variable ... </variables>
  end -- if
end -- for
oldworld:close ()
newworld:close ()
print "done!"



This script reads the entire world line-by-line and drops the stuff between "<variables" and "</variables>".

To make the script work you may have to edit the Lua Sandbox preferences (global preferences) and comment out the line:


io = nil -- no disk IO


by making it:


-- io = nil -- no disk IO


You can run this script in the Immediate scripting window, once you have made Lua your script language in scripting preferences.

If the file is corrupted, that is it stopped saving before reaching the end, edit it in a word processor and rescue the stuff you want (like your triggers), make a new world, and do File -> Import to paste the triggers from the clipboard into your new world.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


7,890 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]