View previous topic :: View next topic |
Author |
Message |
Gavinus
Joined: 31 Mar 2005 Posts: 3
|
Posted: Thu Mar 31, 2005 20:07 Post subject: On reloading a module/restarting after server crash/shutdown |
|
|
Hi there,
i am pretty new at this, but I was able to get the ATS system working in my Module. It works perfectly.
However, of the server crashes or the module is shut down and restarted, the players tradeskills are all reset to '0'!!
Please can someone tellme if there is an easy way to sort this?
As said - the ATS works perfectly until the server is restarted in some way, then rather than looking into the existing database - it simply seems to create a new table.
Please help!!
Gavinus |
|
Back to top |
|
|
Primogenitor
Joined: 08 Jan 2005 Posts: 88
|
Posted: Thu Mar 31, 2005 20:12 Post subject: |
|
|
What database are you using? Is it SQLite, the built-in one? If so, try adding this to the module load
Code: |
#include "aps_include"
void SQLCommit()
{
DelayCommand(300.0, SQLCommit());
string SQL = "COMMIT";
SQLExecDirect(SQL);
SQL = "BEGIN IMMEDIATE";
SQLExecDirect(SQL);
}
void main()
{
DelayCommand(300.0, SQLCommit());
}
|
And the explanation:
SQLite uses transactions. This means that no harddisk access is done while a transaction is active, which significantly increases speed. However, if the server crashes during a transaction then since no harddisk access has been done, all the changes since the transaction started are lost.
What this function does is tell the server to end the current transaction, thus writing the data to the disk, and start a new one. |
|
Back to top |
|
|
Gavinus
Joined: 31 Mar 2005 Posts: 3
|
Posted: Thu Mar 31, 2005 20:17 Post subject: Thanx |
|
|
I am using Mysql and i think the ODBC connections |
|
Back to top |
|
|
NoMercy
Joined: 03 Jan 2005 Posts: 123 Location: UK
|
Posted: Thu Mar 31, 2005 23:52 Post subject: |
|
|
I'm not sure but I think ATS might fall back on local variables when the database isn't available, have you checked that it's actually writing data out to the database?
Also if your using MySQL, you may want to use the direct conenction method rather than going via ODBC, as ODBC does slow down the DB access (don't be scared off by the 'beta' label on the odbc2 module, it's rather stable, even the new features are pretty solid in it now). |
|
Back to top |
|
|
Gavinus
Joined: 31 Mar 2005 Posts: 3
|
Posted: Thu Mar 31, 2005 23:54 Post subject: Thanx dude! |
|
|
Hiya,
Yes the database functions all work correctly - except if the server goes down for whatever reason.
I need something to hook up so that existing players' characters info is uploaded from the database on login.
Have any ideas?
Kind regards,
Gavinus |
|
Back to top |
|
|
NoMercy
Joined: 03 Jan 2005 Posts: 123 Location: UK
|
Posted: Fri Apr 01, 2005 1:53 Post subject: |
|
|
I'm not sure if it's the version of ATS that your using, but this one: http://nwvault.ign.com/Files/scripts/data/1074016469703.shtml worked on by Makzimia (a frequenter of these forums) includes NWNX support.. if it is the version your using, then I'm out of clues, if not looking at it might help you. |
|
Back to top |
|
|
|