ID:1412070
 
(See the best response by Lige.)
Code:
mob
verb
Test()
for(var/T in usr.vars)
usr.vars[T] = initial(usr.vars[T])


Problem description:

I assumed this would be sufficient, but it appears I get a runtime error.


runtime error: Cannot write to atom.type.
proc name: Test (/mob/verb/Test)
source file: Help DM FILE.dm,145
usr: Guest-1450962619 (/mob)
src: Guest-1450962619 (/mob)
call stack:
Guest-1450962619 (/mob): Test()


This led me to creating a list of vars to avoid using initial on. I got the run-time error to disappear, but now I just get Connection Closed.

mob
verb
Test()
var list/avoid_these_vars = list("type","parent_type","verbs","vars","group","locs")
for(var/T in usr.vars)
if(T in avoid_these_vars) continue
world << T
usr.vars[T] = initial(usr.vars[T])
world << T
Best response
I wonder if it's booting you since your code might be resetting your mobs key, ckey, and client vars. That's my only guess. I didn't really try to debug your issue.
Yep, it is. Cheers Lige.
You can actually use the issaved() proc to detect if a variable will be saved to a savefile by default; which is handy to check a few things for other situations like if a variable is tmp, if the variable has changed from its initial value, and if the variable is read-only (const). This might not catch them all though, the variables you had trouble with causing disconnect don't usually fall into any of the issaved() false conditions.

It'll save you some time and guessing, but you'll still need to account for a few things manually.