Author Topic: Variables getting saved  (Read 343 times)

Legacy_AmbrosiaPW

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Variables getting saved
« on: April 30, 2011, 07:04:46 pm »


               Hello,

I know now that if I set a variable on an NPC in game and reboot the server the  variable doesn't get saved. While looking through this module I am modifying I noticed the creator does save variables on the PC. It looks like he uses ExportSingleCharacter(oPC); at the end.

I'm assuming this saves the new variable on the PC so if the server reboots it will have the new variable? It's such a pain to test I thought I would just ask here for a quick, simple answer.

So is this Export function why the variable is saved? Or do the PC variables get saved, just not the NPC ones.

Thank you!
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Variables getting saved
« Reply #1 on: April 30, 2011, 09:21:45 pm »


               

AmbrosiaPW wrote...

Hello,

I know now that if I set a variable on an NPC in game and reboot the server the  variable doesn't get saved.

Variable on NPC do not get saved because you are not saving the game then starting the game by loading the saved game.  You are booting back to a new game. This is really what you want to happen in a PW, cutting out the needless overhead and memory leaks.  

While looking through this module I am modifying I noticed the creator does save variables on the PC. It looks like he uses ExportSingleCharacter(oPC); at the end. I'm assuming this saves the new variable on the PC so if the server reboots it will have the new variable?

 
This assumption is incorrect.  Local Vars that are on the PC never get saved. This again is a good thing.  Since very few scripters take the time to delete the local vars that they place on a PC.  There would be so many vars stored on the PC that it would start to lag the game. 

There is a ray of hope here though.  even though the vars on the PC do not get saved, the vars placed on items in the PC's inventory do get saved.   Most people who do not want to use the boiware DB,  or other external DB to store there presistant data. Use an undroppable item in the PC's inventory to store there data on.   Either creating the item or useing one that is already there, Like the DMFI dice bag. 

As far as the Exporting the character,  That is normally done, by some,  when updating critical data on the item, to prevent exploits.   Even though the number of exploits have already been cut down sice the PC is carrying his own DB with him.   Still exporting the character protects the data encase of a server crash. 


 
               
               

               
            

Legacy_AmbrosiaPW

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Variables getting saved
« Reply #2 on: May 01, 2011, 01:41:45 am »


               Cool thanks. Yes you get an item as a PC which is where I store my variables now. I just wanted to find other ways to store data and to understand the export better.

Thank you!