I think I posted this in the wrong spot, oops. Can't seem to delete it or post it again in the proper one either. I suppose this'll have to do:
Hello,
I'm developing a combat counter for a MUD. It's written in javascript, and uses objects to save relevant data from mud output, store it, and make calculations based on it. I'm trying to develop an alternative method to get the data in the objects saving between sessions. Originally, I had been using a JSON function to stringify the object in question, and SetVariable to save the resulting string to the plugin's save state file. My bug testers discovered that eventually the save state file reaches a certain size, and mushclient can no longer load the data. So, I came up with an alternative idea, using mushclient's notepad functions:
This function stringifies the objects and saves them to text files, which works great. Unfortunately, I can't load the data again when I restart mushclient. I tried using world.Open, which did open mush notepads for the files, however when I tried to use world.GetNotepadText to send the contents of the files back to the script to be parsed back into objects, I discovered that these notepads aren't detectable like the notepads which are opened with functions like ReplaceNotepad. I've been looking around the internet for some way to open the text files, copy their contents, get those contents back into the script to be sent through JSON.parse, but I'm coming up with almost nothing that seems to accomplish this. I really need to figure this out, or my counter won't be able to save between sessions, unless I go back to the original method which b0rks after the save state reaches a certain size. Hoping you guys might be able to point me in the right direction, or dash my hopes entirely and tell me it just isn't possible.
Thanks!
Hello,
I'm developing a combat counter for a MUD. It's written in javascript, and uses objects to save relevant data from mud output, store it, and make calculations based on it. I'm trying to develop an alternative method to get the data in the objects saving between sessions. Originally, I had been using a JSON function to stringify the object in question, and SetVariable to save the resulting string to the plugin's save state file. My bug testers discovered that eventually the save state file reaches a certain size, and mushclient can no longer load the data. So, I came up with an alternative idea, using mushclient's notepad functions:
function saveSets() {
SetVariable("set",set);
world.ReplaceNotepad("ccsave sets",JSON.stringify(sets));
world.SaveNotepad("ccsave sets","c:/program files (x86)/mushclient/worlds/plugins/ccsavesets.txt",1);
world.CloseNotepad("ccsave sets",0);
world.ReplaceNotepad("ccsave options",JSON.stringify(options));
world.SaveNotepad("ccsave options","c:/program files (x86)/mushclient/worlds/plugins/ccsaveoptions.txt",1);
world.CloseNotepad("ccsave options",0);
world.ReplaceNotepad("ccsave truedmg",JSON.stringify(truedmg));
world.SaveNotepad("ccsave truedmg","c:/program files (x86)/mushclient/worlds/plugins/ccsavetruedmg.txt",1);
world.CloseNotepad("ccsave truedmg",0);
};This function stringifies the objects and saves them to text files, which works great. Unfortunately, I can't load the data again when I restart mushclient. I tried using world.Open, which did open mush notepads for the files, however when I tried to use world.GetNotepadText to send the contents of the files back to the script to be parsed back into objects, I discovered that these notepads aren't detectable like the notepads which are opened with functions like ReplaceNotepad. I've been looking around the internet for some way to open the text files, copy their contents, get those contents back into the script to be sent through JSON.parse, but I'm coming up with almost nothing that seems to accomplish this. I really need to figure this out, or my counter won't be able to save between sessions, unless I go back to the original method which b0rks after the save state reaches a certain size. Hoping you guys might be able to point me in the right direction, or dash my hopes entirely and tell me it just isn't possible.
Thanks!