Page 1 of 1

FindConfigElem()

Posted: Fri Sep 08, 2006 4:08 am
by innominabile
When the output of FindConfigElem() change?

If I int my npc ai with code:

Code: Select all

    SetObjProperty(me, "Template", FindConfigElem(ReadConfigFile(":*:npcdesc"), RemovePackageNameFromTemplate(me.npctemplate)));
I must reload FindConfigElem() every time, or I can use:

Code: Select all

function InitNpc(me)
  if (!GetObjProperty(me, "Template"))
    SetObjProperty(me, "Template", FindConfigElem(ReadConfigFile(":*:npcdesc"), RemovePackageNameFromTemplate(me.npctemplate)));
  endif
endfunction
?

Posted: Fri Sep 08, 2006 12:23 pm
by Yukiko
Recently I was working with some cleric scripts writing a GM tool and I found that I had to re-read the cfg file if I did repeated calls to GetConfigStringArray using different data. So it may be the same with FindConfigElem.

Posted: Sat Sep 09, 2006 6:31 am
by innominabile
Beh.... And a new member that point to template element in npcdesc.cfg?
It could be faster.