![]() |
Binary Saving Question - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: Binary Saving Question (/showthread.php?tid=2053) |
Binary Saving Question - Anthony - 03-09-2008 I changed the way MS was saving files and decided to save all the shops in one and spells in one etc. After some testing I noticed that the server only clears the first shop, spell, item. It doesn't clear the rest after that. I think there is something wrong with my method? Here is spells for example and since the SpellEditor LevelReq has to be set to 1 because the scroll bars minimum is 1 it gives me an error when I try to edit any spells after the first one. I hope this is making sense ![]() So I clear the spell. Code: Sub ClearSpell(ByVal Index As Long) Setting LevelReq to 1 like the original MS did. Then my saving and loading code. Code: Sub SaveSpells() Thanks for the help! ![]() Re: Binary Saving Question - Anthony - 03-09-2008 Using the hex editor you said it's only showing that only one of the Spells is saved and that's the first one. It's the same with all the other files too, but that's not really surprising since they are all saved the same way. So for some reason it's not even saving all the maximums of the data. It's just saving the first one then going to the next file. Also, I was under the impression using LenB the way I did gathers all the bytes automatically from the UDT? Re: Binary Saving Question - Anthony - 03-09-2008 So the reason it wasn't saving them all I guess was because I had that If Not FileExist check inside of the For loop. I moved it outside of it and it seems to be working fine now. Re: Binary Saving Question - Rian - 04-09-2008 So I just added Anthony's subs for saving 1 spell file, just for a little testing. Currently, all my spells are saved in separate binary files. All together, the the file siles for my spells folder is about 7kb. My single spells file though, is 14kb. I haven't really done anything major, just added a command button to save the spells differently. Why is there such a gap in the file size? Re: Binary Saving Question - Anthony - 05-09-2008 So now I am determined to find out whats going on and so far I have this. Saving to multiple files as default in MS4, MAX_SPELLS = 255, default MS Spell UDT Bytes - 7,395 Saving to one file, using LenB to determine the total bytes, MAX_SPELLS = 255, default MS Spell UDT. Bytes - 12,220 Saving to one file, counting my own bytes from the UDT, MAX_SPELLS = 255, default MS Spell UDT. Bytes - 7,395 So Dave.. How come LenB is screwing me haha. Re: Binary Saving Question - Rian - 05-09-2008 Using len() cut my 13.9kb file down to 8.21kb Re: Binary Saving Question - Anthony - 06-09-2008 Using Len() is now the same size as if I were to count the bytes myself. It is saving and loading correctly. Any way we can make it smaller? xD. Re: Binary Saving Question - Jacob - 06-09-2008 Make sure to use the smallest types in your UDT? Re: Binary Saving Question - Anthony - 06-09-2008 How do you save only the string size needed instead of the entire 20 bytes every time? |