ID:2389683
 
(See the best response by Multiverse7.)
Problem description:
The heat has probably gotten to me, I've been thinking of a way to make all this work but unfortunately I can't think of a simple solution of which I am sure there is..

As far as I know the obj.vars list is read-only. But my goal is to check each var for a different setting using:
if(var !=  initial(var))
list["[var]"] = var


Thats the easy part and should work for what I want it to do, but just what is the simplest method of checking both the list and the object variables and setting those that have changed?
So far this is the best I could come up with:
                for(var/variable in AM.vars)
if(PO["[variable]"] == AM.vars["[variable]")
AM:variable == PO["[variable]"]


Some help would be great!
You were very close:
datum/proc/ResetVars() // Adds a ResetVars() proc to every object in the world.
var/init
for(var/v in vars)
init = initial(vars[v])
if(vars[v] != init)
try // We must use try, because some vars are read only.
vars[v] = init
catch
continue

Be careful with this, and never use it on a player mob or client, or they will be disconnected!
Best response
I'm not sure why you would ever want to do this, but here is a version that seems to be connection safe and works for player mobs and clients:
datum/proc/ResetVars() // Adds a ResetVars() proc to every datum object in the world.
var/init
if(istype(src, /mob))
for(var/v in vars)
switch(v)
if("key", "ckey", "client")
// Ignore these vars to prevent disconnection.
continue
else
init = initial(vars[v])
if(vars[v] != init)
try // We must use try, because some vars are read only.
vars[v] = init
catch
continue
else
for(var/v in vars)
init = initial(vars[v])
if(vars[v] != init)
try // We must use try, because some vars are read only.
vars[v] = init
catch
continue

client/proc/ResetVars() // Adds a ResetVars() proc to every client in the world.
var/init
for(var/v in vars)
switch(v)
if("key", "ckey", "mob")
// Ignore these vars to prevent disconnection.
continue
else
init = initial(vars[v])
if(vars[v] != init)
try // We must use try, because some vars are read only.
vars[v] = init
catch
continue

You will likely encounter some strange side effects from doing this, even though you remain connected. For example, this will reset mob.verbs, client.verbs, client.show_map, client.show_popup_menus, client.show_verb_panel, client.statpanel, client.statobj, client.eye, client.virtual_eye, client.control_freak, and maybe even client.authenticate, which you may want to add to the exceptions. Still, this could be useful for debugging or something.
Thanks a lot, good to see I was close, I was under the assumption I couldn't edit anything from the vars list, hence troubling my eay forward, but if that isn't a problem I think I can get things going asap again.

And no worries about clients/mobs, they won't fall prey to these methods.