Set the mission variable varName to have value val. val can be a variable of most any type: int, float, string, list of the former, dictionary of the former, etc.
Return the value for mission variable varName. If no such mission variable exists, the value given as defaultVal is returned. If the setToDefault flag is 1, then the mission variable is created and given the value defaultVal and that value is returned.
Does the mission variable varName exist?
# Our ubervillian occasionally deigns to inflict a long-term curse on the pesky heroes def OnCurse(victim): if Mission_VarExists('cursed_heroes'): cursedlist = Mission_GetVar('cursed_heroes') else: cursedlist = [] cursedlist.append(victim) Mission_SetVar('cursed_heroes',cursedlist)
# Our ubervillian occasionally deigns to inflict a long-term curse on the pesky heroes def OnCurse(victim): cursedlist = Mission_GetVar('cursed_heroes',[]) cursedlist.append(victim) Mission_SetVar('cursed_heroes',cursedlist)
Returns 1 if the mission attribute (not variable) attrName exists, returns 0 otherwise. Just a handy utility function.
Set the object variable varName for object to have the value val.
Object_SetVar('lar_gand','girlfriend','tasmia_mallor') Object_SetVar('querl_dox','girlfriend','kara_zor_el') Object_SetVar('salu_digby','girlfriend','ayla_ranzz ') lars_kinfolk = {'del_gand':'brother', 'laurel_gand':'great_great_great_great_niece', 'eltro_gand':'great_great_great_great_nephew', 'kal_el':'adopted_brother'} Object_SetVar('lar_gand','relatives',lars_kinfolk)
Return the value of object variable varName for object. If no such object variable exists, the value given as defaultVal is returned. If the setToDefault flag is 1, then the object variable is created and given the value defaultVal and that value is returned. If no object named object exists, then the default value defaultVal is returned, but no attempt is made to create the object variable (or object).
for hero in getAllHeroes(): if Object_VarExists(hero,'girlfriend'): print '%s and %s, sitting in a tree, K-I-S-S-I-N-G!' \ % (hero,Object_GetVar(hero,'girlfriend'))
Does object have the variable varName?
(These notes are primarily of interest to those wanting to use missionobjvar in missions or Rumble Room sessions that are not using FFX 3.2 or later.)
First, for much better performance, caching is integrated into the module and the caching is dependent on mission type. That means that, for campaign missions, the mission and object variables use write-through caching and are saved-game safe (if you save a game and reload it, the same mission and object variables will be present and will have the values they had when saved). For Rumble Room sessions where games cannot be saved, simulated mission and object variables are used and no time is wasted reading from or writing to game attributes.
A very important change is that the module now does proper object variable retirement, both in cached and uncached versions. That means that we avoid crashes and game interruptions when trying to access object variables for objects that no longer exist in the game. For this to work, the mlogreader module must be running and the activation MLOG module started. That is true by default if FFX 3.2 or greater is running.
Those changes mean that the module requires the presence of python files (modules) mlogreader.py, readsavedattribs.py, and compiled python module _missionvar.pyd somewhere in the python path, most likely the same directory as missionobjvar.py itself. The chunkstring module is no longer required for missionobjvar (though it may still be needed for other modules to work).