Documentation for readsavedattribs.py

Warning: This documentation was generated from the comments in the source code (using progrutils.documentPyFile()), with a few tweaks, under the principle that poor documentation is better than no documentation. In case of ambiguity, please refer to the code itself.

 

Read Saved Attributes

By Stumpy

More parsing through DAT files. This time the saved game file to grab mission attributes.

 

Counting in base 36 - fun for the whole family!

itoa36(num)

only good for ints up to 36**5-1

 

Getting attributes from a saved game file

GrabGlobalAttr(dat,startpos)

GetGlobalAttributes(dat,verbose=0)

return a dictionary of all the attributes as set by GlobalRegisterAttr()

GetMissionAttributes(dat,verbose=0)

return a dictionary of all the attributes as set by Mission_SetAttr()

GetObjectAttributes(dat, object, verbose=0)

return a dictionary of all the attributes as set by Mission_SetAttr()

GetMissionVars(rawattribs)

separate out the normal mission attributes from the long variable attributes

GetAllObjectVars(dat,objectvarnames)

Get the object long variables for all vars and return it as a dictionary

ReadLongVarsFromSavedGame(FileName)

Return a dictionary of all mission vars and a dictionary of all object vars from the given saved game file. This is assuming variables stored the way they are in _missionvars module, as used in missionobjvars version 1.15 and later.

This routine does no caching, in case a later read is requested from
a file saved later under the same name (e.g. a second quicksave).

ReadLongVarsFromSavedGameData(alldat)

(Same as above function, but assumes that the binary data string from the saved-game file is passed. Somewhat more efficient if you happen to have the data already read.)

Return a dictionary of all mission vars and a dictionary of all object vars from the given binary string from a saved game file. This is assuming variables stored the way they are in _missionvars module, as used in missionobjvars version 1.15 and later.

This routine does no caching, in case a later read is requested from a file saved later under the same name (e.g. a second quicksave).