Notepad Saving
Notepad Saving
Searched for a bit, but can't find info on this. Is there a way to force save the Mudlet notepad? Since it saves when it logs out/I close mudlet, whenever Mudlet crashes (which happens 1 in 5 times due to the mapper), I lose all of my changes.
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
Re: Notepad Saving
Searched, but nothing stood out so reviving an old post that didn't seem to have an answer:
I've taken a look at the mudlet notepad, in particular with persistance/backing up of the contents.
The notepad contents are saved inside the profile in the 'notes.txt' file. It would appear to be read on startup, and saved on exit. Are there any commands to allow both force saving of the existing notepad contents, and force reading of the 'notes.txt' file contents to refresh the notepad?
I have a backup function that copies a number of files from the profile elsewhere, and i'd like to add the notepad to this. The problem however comes about when restoring the backup: The script is already running when I copy the 'notes.txt' file back to the profile, so it doesn't get loaded. On exit, it also gets over-written.
I've taken a look at the mudlet notepad, in particular with persistance/backing up of the contents.
The notepad contents are saved inside the profile in the 'notes.txt' file. It would appear to be read on startup, and saved on exit. Are there any commands to allow both force saving of the existing notepad contents, and force reading of the 'notes.txt' file contents to refresh the notepad?
I have a backup function that copies a number of files from the profile elsewhere, and i'd like to add the notepad to this. The problem however comes about when restoring the backup: The script is already running when I copy the 'notes.txt' file back to the profile, so it doesn't get loaded. On exit, it also gets over-written.
Re: Notepad Saving
There's no API function for it right now.
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
Re: Notepad Saving
Thanks, I tried using save/reset Profile to indirectly cause it to happen, but didn't work.
I'll keep in mind at some point i'll need to add save/load functions to mudlet.
I'll keep in mind at some point i'll need to add save/load functions to mudlet.
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Notepad Saving
You might want to check that the file is correctly closed after it is read or written too - I vaguely recall noting that one of the pair of methods that use the file didn't do that - although it might have been a long time ago and been subsequently fixed anyhow...
If you are going to code in that area you might want to do a search here as I think someone one enquired about whether they could access/update the file from lua (and presumably have it updated in the on-screen display widget although that would definitely be a significant code development in that area). I believe Qt could track alterations in the widget and flush them out to the file-system - and possibly raise an event for the lua subsystem to know about it; similarly a lua script command to write to the (whole) file concerned may also I suppose inform the notepad widget to lock for input and then overwrite/replace - however the logistics of having two different "things" both access the same resource {the "file"} at the same time could get into interesting race/data loss conditions...
If you are going to code in that area you might want to do a search here as I think someone one enquired about whether they could access/update the file from lua (and presumably have it updated in the on-screen display widget although that would definitely be a significant code development in that area). I believe Qt could track alterations in the widget and flush them out to the file-system - and possibly raise an event for the lua subsystem to know about it; similarly a lua script command to write to the (whole) file concerned may also I suppose inform the notepad widget to lock for input and then overwrite/replace - however the logistics of having two different "things" both access the same resource {the "file"} at the same time could get into interesting race/data loss conditions...