Thanks scabootssca, but i'm still in trouble.

I can change the variable
GameLogic.frame to getattr(own,GameLogic.aspect) with…

GameLogic.frame = getattr(own,GameLogic.aspect)
(Thanks scabootssca)

which loads a stored property value.

What do i need to do to change
getattr(own,GameLogic.aspect) to GameLogic.frame?

to save the global variable value to that property.

At the moment i get a can’t assign to a function call
if I try

getattr(own,GameLogic.aspect) = GameLogic.frame

As I said, still a little behind on the python syntax.

umm ok?

this is probably the wrong way but

exec(“own.”+GameLogic.aspect+" = GameLogic.frame")

well hey, the other thing you told me worked so i’m sure this will be just as good. thanks a bunch. I promise I am reading my python book as well…not just leeching!
n

will let you know how it goes

yipppeee! looks like my first ever load/save system is basically complete. actually it’s my first ever anything system.
now to work out how to write it to file. I’ve seen some tutes on this stuff.

Thanks so much scabootssca. that exec thing will come in handy. I’m sure i’ll get to it in the book sometime soon.

Just a Hint:

getattr()
setattr()
hasattr()

can be very usfull :slight_smile:

To write on file I store everything in a dictionary. If you write the dictionary to a file you get a text file with the dictionary in Python format. This allows you to

  • read whatever you have saved
  • edit if you want.
  • allows you all basic python types (including tuples and dicts, but no objects)
    [edit:]
  • you don’t need to worry about the order of data stored as it is one dictionary and Python is organizing this for you

I hope this helps

[quote=Monster;754366]Just a Hint:

getattr()
setattr()
hasattr()

can be very usfull :slight_smile:

boy, they sure can be! have rewrittten all my scripts using these. thanks monster. tooks me a little while to work out where the commas etc go but it was worth it.