ID:1760757
 
So I am trying to play my game but after I try loading a file this happens and doesn't load half the stuff that is in the savefile:
runtime error: cannot append to list proc name: LoadFile (/mob/proc/LoadFile) source file: Saving and Loading.dm,13 usr: Dev (/mob) src: Dev (/mob) call stack: Dev (/mob): LoadFile() Dev (/mob): StartScreen(Dev (/mob)) Dev (/mob): enter()

Its telling me to go straight to line 13 in the Saving and Loading.dm. Fair enough but I goto the line and it's a line that cannot be modified except through datum which I have tried over hundreds of time but I keep getting errors.

Read(F)


Now I do some stress testing to repeat the problem and it only occurs after the EndDuel() proc is called. I play around with the list and find the problem thats causing it which is shown below.

mob/proc/EndDuel(var/mob/A)
A.main_deck = new()
A.extra_deck = new()
A.side_deck = new()
A.hand = new()
A.graveyard = new()
A.banished = new()

for(var/mob/B in A.oppenents)
B.oppenents -= A

if(B.oppenents.len == 0)
FindOppenent(B)

sleep()
...


There is more to the code but it is not the cause of the problem. I do not know what I am doing wrong but someone who might know this stuff way more than me might. :)
Okay so I fixed it but using a new system coded and I was able to get it working. (I HOPE).

runtime error: cannot append to list proc name...

Well, you should run a few checks usually.

if(!fexists(file) || !list || istype(list, /savefile))
return


Those are just some examples. I'm not too sure on the /savefile part though. Mainly because I've never had to check the type of a savefile. I simply check if my file exists and I pull from it what I need at startup only.

But, what I have presented should make sure the error does not occur again. However, this doesn't fix the problem where you can't append to the list. If it doesn't exist in the first place, you should also check whether or not you are creating it properly. So, do that as well.