Notepad Saving

Post Reply
Loem
Posts: 17
Joined: Tue Jul 09, 2013 9:52 pm

Notepad Saving

Post by Loem »

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.

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Notepad Saving

Post by Nyyrazzilyss »

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.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Notepad Saving

Post by Vadi »

There's no API function for it right now.

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Notepad Saving

Post by Nyyrazzilyss »

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.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Notepad Saving

Post by SlySven »

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...

Post Reply