ID:146644
 
Hello, i'm making a save code for a ingame Music Box
which saves its music which is uploaded to it.

*Note: Kinda like the DJ in icon chatters with a few additions*

There are some problems in the code right now like when
the game is reloaded, it stacks one musicbox on top of
another, and after like 20 reboots, all thoes music boxes
add up on top of one another.

lol there are a few downsides to this system, like all thoes
songs add to the rsc file of the game but I alloted a system
which limits the size of the files they can upload to it.
*Note: I could make it save in another file other than the rsc file.*

Can some1 help me with the save sode
Here is what i have that there is some problems with *Stated above*

world
New(){SongsLoad()}
Del(){SongsSave()}

obj/MusicBox/var{saved_x;saved_y;saved_z}
proc/SongsSave()
var/savefile/F = new ("Music.sav")
var/list/L = new
for(var/obj/MusicBox/B in world)
B.saved_x = B.x;B.saved_y = B.y;B.saved_z = B.z;L += B
F[""] << L
proc/SongsLoad()
var/savefile/F = new ("Music.sav")
var/list/L = new
F[""] >> L
if(!L) return
for(var/obj/MusicBox/B in L)
B.loc = locate(B.saved_x,B.saved_y,B.saved_z)


Note: The code i'm doing for the Music Box is a lil top secret and when i figure out a good save system for it, and fix a few bugs in the coding.