Author Topic: NWNX_funcs output all cariables on a creature  (Read 357 times)

Legacy_DM_Vecna

  • Hero Member
  • *****
  • Posts: 501
  • Karma: +0/-0
NWNX_funcs output all cariables on a creature
« on: July 06, 2014, 06:46:36 am »


               

Does anyone have a function already built that will output a list of all variables stored on a creature? Virusman said that this is possible by using GetFirstLocalVariable and GetNextLocalVariable. However I am no Virusman and it will take me much longer to figure this out than grab a working function from someone else. If anyone is interested below is where I am currently to get this to work for myself. But it seems that I am getting a TMI error due to my while statement never concluding. 


 


THanks for any help


 


 


void ListVariables(object oCreature)

{

AWA_DEBUG("awa_inc_spawn/ListVariables: Fired");

struct LocalVariable PCVars = GetFirstLocalVariable(oCreature);

AWA_DEBUG("awa_inc_spawn/ListVariables: name = "+PCVars.name+" pos = "+IntToString(PCVars.pos)+" obj = "+ObjectToString(PCVars.obj)+" type = "+IntToString(PCVars.type));

 

    while (PCVars.obj != OBJECT_INVALID)

    {

    PCVars = GetNextLocalVariable(PCVars);

    AWA_DEBUG("awa_inc_spawn/ListVariables: name = "+PCVars.name+" pos = "+IntToString(PCVars.pos)+" obj = "+ObjectToString(PCVars.obj)+" type = "+IntToString(PCVars.type));

 

    }

}


               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
NWNX_funcs output all cariables on a creature
« Reply #1 on: July 06, 2014, 07:23:58 am »


               

The object in the local variable struct is oCreature so it will never be OBJECT_INVALID.  In the while predicate you can use the nwnx_funcs function: 



int GetIsVariableValid (struct LocalVariable lv);