New NWNx4 Persistency retrofit discussion
Moderators: ALFA Administrators, Staff - Technical
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
New NWNx4 Persistency retrofit discussion
Did a first pass at importing these today: guessing you've got a few more files that missed the commit boat.
One seems to be acr_spelltrack_i.nss : the version on the SVN has _playerHasCasterClass(), which you seem to have graduated to a public function, ACR_PlayerHasClass(), in several of the new systems.
I'm also getting an undefined variable or constant, I think on ACR_SERVER_IP in the acr_mod_events_i.nss, not sure where you have that defined in your code.
also:
General question: should we be getting rid of / retrofitting anything that still uses the ACR_GetPCPersistentStorageObject() calls, or do we have those all wrapped to point at the new backend?
One seems to be acr_spelltrack_i.nss : the version on the SVN has _playerHasCasterClass(), which you seem to have graduated to a public function, ACR_PlayerHasClass(), in several of the new systems.
I'm also getting an undefined variable or constant, I think on ACR_SERVER_IP in the acr_mod_events_i.nss, not sure where you have that defined in your code.
also:
General question: should we be getting rid of / retrofitting anything that still uses the ACR_GetPCPersistentStorageObject() calls, or do we have those all wrapped to point at the new backend?
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Rats. I'll commit the spell track code. ACR_SERVER_IP should be defined in acf_settings_i. I'll commit a new placeholder in the repository. Thanks for the sanity checks AL. It's not always easy keeping track of all the modified files when doing a large update. To borrow a phrase from Hugh Grant, sorry for the cock up.
And yes, we do need to completely phase out usage of ACR_GetPCPersistentStorageObject() (though the main include should be left alone - just not used). If you're using that in any spawn code or systems you're working on, it'll need to be replaced with the new persistence functions.
Let me know if you have any questions.
And yes, we do need to completely phase out usage of ACR_GetPCPersistentStorageObject() (though the main include should be left alone - just not used). If you're using that in any spawn code or systems you're working on, it'll need to be replaced with the new persistence functions.
Let me know if you have any questions.
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Not a problem- I tried plugging a few placeholders in to make sure the rest of it compiled, I think those two were all that was missing from the batch. I still somehow suspect I've missed out committing something somewhere from the last ACR release.
I may give the new code another try tonight if I have time.
I may give the new code another try tonight if I have time.
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Ok, let me know if you run into any other problems with the latest commit. I think we can consider compiling another release fairly soon. Just to give you a heads up though, the upcoming week is going to be rather hectic at work so I won't be able to spend much time scripting. I'll be in the clear after that.
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Allright, in the early stages of testing, also did the retrofit for acr_xp_i, which also disables the need for validation for now. I'll commit it as soon as I confirm that it actually works as advertised.
When I try to log into my test server, I'm getting booted. The DB creates a record in Players, servers, IP addresses, and CD keys, but not in characters. logs and such show aquire events for the PCs I'm trying, but they're not writing to the "characters" table at all.
I also notice that character ID for all "logs" table entries = 0, so may be something missing from the insert statement for logging.
Thoughts on what might be going wrong?
When I try to log into my test server, I'm getting booted. The DB creates a record in Players, servers, IP addresses, and CD keys, but not in characters. logs and such show aquire events for the PCs I'm trying, but they're not writing to the "characters" table at all.
I also notice that character ID for all "logs" table entries = 0, so may be something missing from the insert statement for logging.
Thoughts on what might be going wrong?
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Take a peek in your xp_mysql.txt sql log file (wherever you installed NWNx4) and see if any statements are failing. I wasn't getting booted, but then the login script had already created those records for me. My guess is that there may be a syntactical error in one of the sql statements, though I don't recall changing those since I verified them. I did break up the processing into two parts however - OnClientEnter and OnPCLoaded - so perhaps some condition(s) is not being satisfied when OnPCLoaded fires.....
p.s. Are you getting booted on subsequent login attempts with the same character?
p.s. Are you getting booted on subsequent login attempts with the same character?
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
I am getting booted on subsequent attempts. The write to "characters" occurs during the ACR_PCOnClientEnter() function in acr_pps_i.nss, right after the writes to player, CD key, and IP address, so I'm guessing it's that statement that's failing.
Checking that SQL file, there is an error logged that I overlooked:
Not terribly desctriptive, though.
The section of code that tries to write the record is here at line 301:
Could it be that it's trying to pass a string for ServerID instead of an integer?
Checking that SQL file, there is an error logged that I overlooked:
Code: Select all
! Error (mysql_query): Column count doesn't match value count at row 1.
The section of code that tries to write the record is here at line 301:
Code: Select all
ACR_SQLQuery("INSERT INTO characters (ServerID, PlayerID, Name, Level, Race, Subrace, Deity, Gender, HP, XP, GP, Ethics, Morals, Class1, Class2, Class3, Level1, Level2, Level3, STR, CON, DEX, `INT`, WIS, CHA, Damage, Deaths, IsOnline, IsDeleted, IsPlayable) VALUES (" +
IntToString(ACR_SERVER_ID) + "," +
sPID + ",'" +
sCharacterName + "'," +
IntToString(GetHitDice(oPC)) + "," +
IntToString(GetRacialType(oPC)) + "," +
IntToString(GetSubRace(oPC)) + ",'" +
GetDeity(oPC) + "'," +
IntToString(GetGender(oPC)) + "," +
IntToString(GetCurrentHitPoints(oPC)) + "," +
IntToString(GetXP(oPC)) + "," +
IntToString(GetGold(oPC)) + "," +
IntToString(GetGoodEvilValue(oPC)) + "," +
IntToString(GetLawChaosValue(oPC)) + "," +
IntToString(GetClassByPosition(1, oPC)) + "," +
IntToString(GetClassByPosition(2, oPC)) + "," +
IntToString(GetClassByPosition(3, oPC)) + ",1,0,0," +
IntToString(GetAbilityScore(oPC, ABILITY_STRENGTH)) + "," +
IntToString(GetAbilityScore(oPC, ABILITY_CONSTITUTION)) + "," +
IntToString(GetAbilityScore(oPC, ABILITY_DEXTERITY)) + "," +
IntToString(GetAbilityScore(oPC, ABILITY_INTELLIGENCE)) + "," +
IntToString(GetAbilityScore(oPC, ABILITY_WISDOM)) + "," +
IntToString(GetAbilityScore(oPC, ABILITY_CHARISMA)) + ",'" + "',0,0,1,0,1)");
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
What's the preceding SQL statement or statements?AcadiusLost wrote:Checking that SQL file, there is an error logged that I overlooked:Code: Select all
! Error (mysql_query): Column count doesn't match value count at row 1.
Well, if ACR_SERVER_ID is a number and the column is an integer (which it is), then MySQL treats it as an integer. To generate an error, I think you'd have to try to pass a string to an integer column w/o quotes.Could it be that it's trying to pass a string for ServerID instead of an integer?
Easiest way to find where it's failing might be to just comment out the boot statements one at a time.
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Unfortunately, the xp_mysql.txt doesn't have a preceeding SQL statement: here is the file in it's entirety.
I can only guess that it's the insertion line into "characters", as the preceding one seems to have written to the DB successfully. I'll try commenting out the boot command associated with it and see if that lets us get further along.
Code: Select all
NWNX MySQL Plugin V.0.0.1
(c) 2006 by Ingmar Stieger (Papillon)
visit us at http://www.nwnx.org
(built using mysql-5.0.27 source)
* Connecting to server x3mkungen.mine.nu
* Plugin initialized.
* Registering under function class SQL
! Error (mysql_query): Column count doesn't match value count at row 1.
* Plugin unloaded.
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
Ok. Check your nwnx.ini file (or maybe it's mysql.ini) and make sure the log option is set to 2. That will log everything. At that setting, you should see all the SQL statements executed by the ACR in your sql log file along with their return values and any associated warnings or errors. This output will obviously help debug our sql but it'll also be a good way to identify potential optimizations.
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Did some more testing and tinkering with this late last night.
In no case is it writing records to the "characters" table. The other tables seem to be updating fine. I was able to join the module with a PC by commenting out two of the bootPC lines: the one checking the insertion into characters onPCClientEnter, and the one checking the query from characters OnPCClientAreaLoaded. Couldn't test much in terms of other systems, as I expect most of them need to reference the characters table. Had a careful look over the INSERT syntax, couldn't see anything wrong with it. The "logs" table records the errors in loading the characters, as well- so there has to be something going wrong with that insertion. The NWNx4 log file still just shows that same error from before (albeit in repeat for each time I tried).
The one thing I didn't try, was to manually enter one of my PCs into the characters table with the SQL browser, and then see if it worked for other systems (or updated properly for PC death and such).
Cipher, can you try rolling a PC under a new GSID (or even your normal one) to confirm that it's still working on your end?
In no case is it writing records to the "characters" table. The other tables seem to be updating fine. I was able to join the module with a PC by commenting out two of the bootPC lines: the one checking the insertion into characters onPCClientEnter, and the one checking the query from characters OnPCClientAreaLoaded. Couldn't test much in terms of other systems, as I expect most of them need to reference the characters table. Had a careful look over the INSERT syntax, couldn't see anything wrong with it. The "logs" table records the errors in loading the characters, as well- so there has to be something going wrong with that insertion. The NWNx4 log file still just shows that same error from before (albeit in repeat for each time I tried).
The one thing I didn't try, was to manually enter one of my PCs into the characters table with the SQL browser, and then see if it worked for other systems (or updated properly for PC death and such).
Cipher, can you try rolling a PC under a new GSID (or even your normal one) to confirm that it's still working on your end?