Author Topic: Exit Event and Character Exporting  (Read 391 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Exit Event and Character Exporting
« on: August 12, 2012, 05:16:06 pm »


               Is it redundant to add a ExportSingleCharacter function in the module's Exit Event?

I ask because I track some data on the PC Skin, and do not believe it is saved unless the PC is exported. And I want to ensure that the PC is exported when logging out.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Exit Event and Character Exporting
« Reply #1 on: August 12, 2012, 05:27:26 pm »


               Character is saved in OnExit automatically.
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Exit Event and Character Exporting
« Reply #2 on: August 12, 2012, 05:33:27 pm »


               Since the function executes after an undetermined delay it might be risky to call it from the exit event. Nwnx_funcs hooks the event, though. Characters have always been saved automatically for me, I guess I'm lucky since I don't know what this depends on...

EDIT: Beaten by the punch, never mind if appropriate.


Kato
               
               

               


                     Modifié par Kato_Yang, 12 août 2012 - 04:36 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Exit Event and Character Exporting
« Reply #3 on: August 12, 2012, 05:45:45 pm »


               Thanks. I wanted to verify this.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Exit Event and Character Exporting
« Reply #4 on: August 12, 2012, 05:47:21 pm »


               Also what is the order of Exit events.

Is it Trigger then Area then Module?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Exit Event and Character Exporting
« Reply #5 on: August 12, 2012, 05:50:52 pm »


               

henesua wrote...

Also what is the order of Exit events.

Is it Trigger then Area then Module?

there is some info about this in lexicon, however it might be outdated and if you can try it yourself. New info about this would be welcome. (especially, if in any of those events, characters location can be found - hardly, but worth the try)

Btw, this automatic save character occurs a while before OnExit fires, I think that nwnx_cool is using this to fire OnPreExit where PC is still valid. It is however not hookable without nwnx, its internal use of the ExportChar function.
               
               

               


                     Modifié par ShaDoOoW, 12 août 2012 - 04:54 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Exit Event and Character Exporting
« Reply #6 on: August 12, 2012, 06:01:45 pm »


               It is interesting that you say saving of the character happens sometime before the OnExit event script executes. This means that I can not depend on setting local vars to the PC skin just before exit.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Exit Event and Character Exporting
« Reply #7 on: August 12, 2012, 06:09:23 pm »


               Hm, correct, if you are doing this in the mentioned nwnx event, then this might be the reason why you have the problem you are mentioning. But if you are not using nwnx, then this doesnt apply the save and OnExit event are done in the same fashion practically, just the save occurs a bit earlier when PC is still valid. Since you cannot retrieve any items in normal OnExit, there is no such issue.