ACR Compile Error Details

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

ACR Compile Error Details

Post by indio »

Just to cover bases, here are the compile error details in the mod since installing the new haks and importing the ACR code:

Error 1
Error: nwnx_sql.nss(13): ERROR: FUNCTION DEFINITION MISSING NAME
Line in script:

Code: Select all

const int SQL_ERROR = 0;
Error 2
Error: aca_it_validation.nss(48): ERROR: UNDEFINED IDENTIFIER
Line in script:

Code: Select all

    if (ACR_GetIsPlayerDead(ACR_GetPCPersistentStorageObject(oUser))) {
Error 3
Error: acr_db_persist_i.nss(38): ERROR: FUNCTION DEFINITION MISSING NAME
Line in code:

Code: Select all

const int SQL_ERROR = 0;
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

You can remove my aca_it_validation.nss script, there is no need or purpose for it in the new ACR. It was fixing level validation (which is disabled now) on the PC Skin (which no longer exists)- so it's been quite thoroughly made redundant.

As for the other two, I'm not sure what to say- they compile fine for me. Both are hanging on the definition of the same constant integer- though the error isn't what I'd expect for a definition conflict.

Wish I had a good answer for you- only thing I can think is maybe some leftover framework from your previous NWNx4/SQL implementation is conflicting with the one in the ACR and 1.08 NWNx4.

Just to confirm, the header on "nwnx_sql.nss" in my version looks like this:

Code: Select all

// Name     : NWNX SQL include
// Purpose  : Scripting functions for NWNX SQL plugins
// Author   : Ingmar Stieger
// Modified : 09/12/2006
// Copyright: This file is licensed under the terms of the
//            GNU GENERAL PUBLIC LICENSE (GPL) Version 2
//            Based on aps_include by Ingmar Stieger, Adam Colon, Josh Simon
That match up with what you're seeing when you open it up?
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Yeah, it's the right version.

Take a look at this for me will you AL? I don't know what I'm looking for. When I remove this script, the ALFA stuff compiles but my quests don't. Any way I can merge the two?

Code: Select all

#include "nwnx_sql"
//::///////////////////////////////////////////////
//:: Persistent Quests & Journal Entries / Beta
//:: With support for NWNX2 and the APS/ODBC plugin
//:: qst__pqj_nwnx_inc
//::///////////////////////////////////////////////

//:://///////////////////////////////////////////////////////////////
//:: Having recently begun working with NWNX and the odbc plugin, I
//:: was looking for a way to track completed quests and journal
//:: entries.  I found Knat's system but wanted something that used
//:: MySQL.  I decided to use his code as a starting point and
//:: rewrote the functions to make calls to a MySQL table where this
//:: data is stored.  All credit goes to Knat for the basic design
//:: which I found extremely easy to put in place and modify.
//:://///////////////////////////////////////////////////////////////


/*
Prerequisites to putting this system in place:

1.  NWNX2 and the APS/ODBC plugin MUST be in place.  Please fully
test this and insure consistent communication between NWNX2
and your MySQL database.  This includes having the appropriate
OnModuleLoad event defined.  For help on any of this please see
http://www.nwnx.org/

2. Use the following SQL statement to create your table:

CREATE TABLE tbl_questdata(
   ID                   int auto_increment,
   player_acct          varchar(64) NOT NULL DEFAULT '',
   player_character     varchar(64) NOT NULL DEFAULT '',
   szPlotID             varchar(32) NOT NULL DEFAULT '',
   szPlotState          varchar(4) NOT NULL DEFAULT ''
)
GO

If this doesn't make any sense, please post your question on
the NWNX forums.


3.  I chose to distribute this without touching Knat's original code.
To use the NWNX version, I recommend taking the included sample
mod and changing all the include reference at the top of the
included scripts.  Something like this:

//#include "pqj_inc"
#include "qst__pqj_nwnx_inc"

This will comment the original reference out, leaving that code in
place and instead use my modified functions.

If anyone wants a copy of the mod with modifications in place, please
send an email to grim@velozity.com.
*/

//:://////////////////////////////////////////////
//:: Created By: Grim Havoc
//:: Created On: January 11, 2005
//:://////////////////////////////////////////////

// database table name
const string PQJ_TABLE       = "Table_AutoQuestData";

// table schema:
//
// ID                   integer
// player_acct          varchar(64)
// player_character     varchar(200)
// szPlotID             varchar(32)
// szPlotState          char(4)
//
// ID is an autoincremented number and serves merely as an index
// player_acct and player_character store player account and character name
// szPlotID  comes from the Journal tag for the quest
// szPlotState corresponds to the Journal tag ID number
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
//  FUNCTIONS and original documentation follow
// -----------------------------------------------------------------------------
// transparent wrapper to AddJournalQuestEntry
// use this function instead of the original one to store quest/journal data
// persistently using the bio DB. all function parameters work similar to the original function
//
// Add a journal quest entry to oCreature.
// - szPlotID: the plot identifier used in the toolset's Journal Editor
// - nState: the state of the plot as seen in the toolset's Journal Editor
// - oCreature
// - bAllPartyMembers: If this is TRUE, the entry will show up in the journal of
//   everyone in the party
// - bAllPlayers: If this is TRUE, the entry will show up in the journal of
//   everyone in the world
// - bAllowOverrideHigher: If this is TRUE, you can set the state to a lower
//   number than the one it is currently on
void AddPersistentJournalQuestEntry(string szPlotID, int nState, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE, int bAllowOverrideHigher=FALSE);

// transparent wrapper to RemoveJournalQuestEntry()
// use this function instead of the original one to remove quest/journal data
// persistently using the bio DB. all function parameters work similar to the original function
//
// Remove a journal quest entry from oCreature.
// - szPlotID: the plot identifier used in the toolset's Journal Editor
// - oCreature
// - bAllPartyMembers: If this is TRUE, the entry will be removed from the
//   journal of everyone in the party
// - bAllPlayers: If this is TRUE, the entry will be removed from the journal of
//   everyone in the world
void RemovePersistentJournalQuestEntry(string szPlotID, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE);

// use this function to rebuild the journal on oCreature using the bio DB
// a good place is the Module OnClientEnter() event
void RebuildJournalQuestEntries(object oCreature);

// retrieve persistent quest state from the DB
// - szPlotID: the plot identifier used in the toolset's Journal Editor
int RetrieveQuestState(string szPlotID, object oCreature);

// retrieves the lowest quest state on any of the PC's party
int PQJ_RetrieveLowestPartyQuestState(object oPC,string szPlotID);

// retrieves the highest quest state on any of the PC's party
int PQJ_RetrieveHighestPartyQuestState(object oPC,string szPlotID);
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

void RebuildJournalQuestEntries(object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  sPlayerAcct = SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "'";

    string sSQL = "SELECT szPlotID, szPlotState FROM " + PQJ_TABLE + " WHERE" + playerSQL;
    SQLExecDirect(sSQL);
    int rs = SQLFetch();
     while(rs == SQL_SUCCESS)
     {
        string questID    = SQLGetData(1);
        string questState = SQLGetData(2);

      AddJournalQuestEntry(questID, StringToInt(questState), oCreature, FALSE, FALSE);

        rs = SQLFetch();
     }
  }
}

void StoreQuestEntry(string szPlotID, int nState, object oCreature, int bAllowOverrideHigher=FALSE)
{
  if(GetIsPC(oCreature))
  {

    string  journalSQL;
    string  sPlayerAcct = SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "' AND szPlotID='" + szPlotID + "'";

    string sSQL = "SELECT szPlotState FROM " + PQJ_TABLE + " WHERE" + playerSQL;

    SQLExecDirect(sSQL);
    int rs = SQLFetch();
     if(rs == SQL_SUCCESS)
     {
        string journalSQL = "UPDATE " + PQJ_TABLE + " SET szPlotState = '" + IntToString(nState) + "' WHERE" + playerSQL;

        SQLExecDirect(journalSQL);
     }
     else
     {
        string fieldsSQL = " (player_acct,player_character, szPlotID, szPlotState) ";
        string valueSQL  = " ('" + sPlayerAcct + "','" + sPlayerChar + "','" + szPlotID + "','"  + IntToString(nState) + "')";
        string journalSQL = "INSERT INTO " + PQJ_TABLE + fieldsSQL + "VALUES" + valueSQL;

        SQLExecDirect(journalSQL);
     }
  }
}


void AddPersistentJournalQuestEntry(string szPlotID, int nState, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE, int bAllowOverrideHigher=FALSE)
{
  // standard nwn AddJournalQuestEntry function call
  AddJournalQuestEntry(szPlotID, nState, oCreature, bAllPartyMembers, bAllPlayers, bAllowOverrideHigher);
  // after standard functional call begin logic for database storing of data
  if(bAllPlayers)
  {
    // all players
    object oPC = GetFirstPC();
    while(GetIsObjectValid(oPC))
    {
      if(GetIsPC(oPC)) StoreQuestEntry(szPlotID, nState, oPC, bAllowOverrideHigher);
      oPC = GetNextPC();
    }
  }
  else if(bAllPartyMembers)
  {
    // all party members
    object oPartyMember = GetFirstFactionMember(oCreature, TRUE);
    while (GetIsObjectValid(oPartyMember))
    {
      StoreQuestEntry(szPlotID, nState, oPartyMember, bAllowOverrideHigher);
      oPartyMember = GetNextFactionMember(oCreature, TRUE);
    }
  }
  else
  {
    StoreQuestEntry(szPlotID, nState, oCreature, bAllowOverrideHigher);
  }
}

void DeleteQuestEntry(string szPlotID, object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  sPlayerAcct = SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "' AND szPlotID='" + szPlotID + "'";

    string sSQL = "DELETE FROM " + PQJ_TABLE + " WHERE" + playerSQL;

    SQLExecDirect(sSQL);
  }
}

void RemovePersistentJournalQuestEntry(string szPlotID, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE)
{
  RemoveJournalQuestEntry(szPlotID, oCreature, bAllPartyMembers, bAllPlayers);
  // store data
  if(bAllPlayers)
  {
    // all players
    object oPC = GetFirstPC();
    while(GetIsObjectValid(oPC))
    {
      if(GetIsPC(oPC))   DeleteQuestEntry(szPlotID, oPC);
      oPC = GetNextPC();
    }
  }
  else if(bAllPartyMembers)
  {
    // whole group
    object oPartyMember = GetFirstFactionMember(oCreature, TRUE);
    while (GetIsObjectValid(oPartyMember))
    {
      DeleteQuestEntry(szPlotID, oPartyMember);
      oPartyMember = GetNextFactionMember(oCreature, TRUE);
    }
  }
  else
  {
    // player only
    DeleteQuestEntry(szPlotID, oCreature);
  }
}

int RetrieveQuestState(string szPlotID, object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  sPlayerAcct = SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "' AND szPlotID='" + szPlotID + "'";

    string sSQL = "SELECT szPlotState FROM " + PQJ_TABLE + " WHERE" + playerSQL;

    SQLExecDirect(sSQL);
    int rs = SQLFetch();
     if(rs == SQL_SUCCESS)
     {
        string strQuestState = SQLGetData(1);
        return StringToInt(strQuestState);
     }
     else
     {
     return 0;
     }
  }
  return 0;
}

// retrieves the lowest quest state on any of the PC's party
int PQJ_RetrieveLowestPartyQuestState(object oPC,string szPlotID)
{
    int nLowestValue = RetrieveQuestState(szPlotID, oPC);
    int nValue;
    object oMember;

    oMember = GetFirstFactionMember(oPC);

    while (GetIsObjectValid(oMember))
    {
        nValue = RetrieveQuestState(szPlotID, oMember);
        if (nValue < nLowestValue) nLowestValue = nValue;
        oMember = GetNextFactionMember(oPC);
    }
    return nLowestValue;
}

// retrieves the highest quest state on any of the PC's party
int PQJ_RetrieveHighestPartyQuestState(object oPC,string szPlotID)
{
    int nHighestValue = 0;
    int nValue;
    object oMember;

    oMember = GetFirstFactionMember(oPC);

    while (GetIsObjectValid(oMember))
    {
        nValue = RetrieveQuestState(szPlotID, oMember);
        if (nValue > nHighestValue) nHighestValue = nValue;
        oMember = GetNextFactionMember(oPC);
    }
    return nHighestValue;
}
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

I've pasted that in as a script, made another script that has it as an #include, and still no compilation errors in my background.

On a side note, looks like that system presumes the table is set up beforehand in the schema, which means it'll fail any checks looking for it currently on our current schema. I can manually add the table to help you maintain compatibility in the near-term, but it's not going to solve your compile problems.

can you paste in the "qst__pqj_nwnx_inc" script, that's an #include here? The answer may well be buried in there (sounds like it's a NWNx2 file, there may be some limits to the NWNx4 backward compatibility)
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Actually, strike that theory, that "qst__pqj_nwnx_inc" script isn't actually included, it's up in the commented-out header of the file, so it's not the source of our troubles.

I get a similar error if I #include "nwnx_sql" and "acr_db_persist_i" in the same script, or in a script with the other in an #include - basically, they both define SQL_SUCCESS and SQL_ERROR - so you end up with a conflict.

So, it's a matter of figuring out where both of them are butting heads, and working out if one can step aside. I'll give it 10-15 min and see if I can render an informed guess.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

That's the include file, already posted, called qst__pqj_nwnx_inc. The place in the script it references that include is actually commented out.
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

And lo, on the second day of this, our ACR, the troublesome script was ALFAtised.

Code: Select all

#include "acr_db_persist_i"

//::///////////////////////////////////////////////
//:: Persistent Quests & Journal Entries / Beta
//:: With support for NWNX2 and the APS/ODBC plugin
//:: qst__pqj_nwnx_inc
//::///////////////////////////////////////////////

//::///////////////////////////////////////////////
//::
//:: edited 8/27/2007 by AcadiusLost, to use ALFA ACR 
//::  functions for the SQL interface.
//::
//::///////////////////////////////////////////////

//:://///////////////////////////////////////////////////////////////
//:: Having recently begun working with NWNX and the odbc plugin, I
//:: was looking for a way to track completed quests and journal
//:: entries.  I found Knat's system but wanted something that used
//:: MySQL.  I decided to use his code as a starting point and
//:: rewrote the functions to make calls to a MySQL table where this
//:: data is stored.  All credit goes to Knat for the basic design
//:: which I found extremely easy to put in place and modify.
//:://///////////////////////////////////////////////////////////////


/*
Prerequisites to putting this system in place:

1.  NWNX2 and the APS/ODBC plugin MUST be in place.  Please fully
test this and insure consistent communication between NWNX2
and your MySQL database.  This includes having the appropriate
OnModuleLoad event defined.  For help on any of this please see
http://www.nwnx.org/

2. Use the following SQL statement to create your table:

CREATE TABLE tbl_questdata(
   ID                   int auto_increment,
   player_acct          varchar(64) NOT NULL DEFAULT '',
   player_character     varchar(64) NOT NULL DEFAULT '',
   szPlotID             varchar(32) NOT NULL DEFAULT '',
   szPlotState          varchar(4) NOT NULL DEFAULT ''
)
GO

If this doesn't make any sense, please post your question on
the NWNX forums.


3.  I chose to distribute this without touching Knat's original code.
To use the NWNX version, I recommend taking the included sample
mod and changing all the include reference at the top of the
included scripts.  Something like this:

//#include "pqj_inc"
#include "qst__pqj_nwnx_inc"

This will comment the original reference out, leaving that code in
place and instead use my modified functions.

If anyone wants a copy of the mod with modifications in place, please
send an email to grim@velozity.com.
*/

//:://////////////////////////////////////////////
//:: Created By: Grim Havoc
//:: Created On: January 11, 2005
//:://////////////////////////////////////////////

// database table name
const string PQJ_TABLE       = "Table_AutoQuestData";

// table schema:
//
// ID                   integer
// player_acct          varchar(64)
// player_character     varchar(200)
// szPlotID             varchar(32)
// szPlotState          char(4)
//
// ID is an autoincremented number and serves merely as an index
// player_acct and player_character store player account and character name
// szPlotID  comes from the Journal tag for the quest
// szPlotState corresponds to the Journal tag ID number
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
//  FUNCTIONS and original documentation follow
// -----------------------------------------------------------------------------
// transparent wrapper to AddJournalQuestEntry
// use this function instead of the original one to store quest/journal data
// persistently using the bio DB. all function parameters work similar to the original function
//
// Add a journal quest entry to oCreature.
// - szPlotID: the plot identifier used in the toolset's Journal Editor
// - nState: the state of the plot as seen in the toolset's Journal Editor
// - oCreature
// - bAllPartyMembers: If this is TRUE, the entry will show up in the journal of
//   everyone in the party
// - bAllPlayers: If this is TRUE, the entry will show up in the journal of
//   everyone in the world
// - bAllowOverrideHigher: If this is TRUE, you can set the state to a lower
//   number than the one it is currently on
void AddPersistentJournalQuestEntry(string szPlotID, int nState, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE, int bAllowOverrideHigher=FALSE);

// transparent wrapper to RemoveJournalQuestEntry()
// use this function instead of the original one to remove quest/journal data
// persistently using the bio DB. all function parameters work similar to the original function
//
// Remove a journal quest entry from oCreature.
// - szPlotID: the plot identifier used in the toolset's Journal Editor
// - oCreature
// - bAllPartyMembers: If this is TRUE, the entry will be removed from the
//   journal of everyone in the party
// - bAllPlayers: If this is TRUE, the entry will be removed from the journal of
//   everyone in the world
void RemovePersistentJournalQuestEntry(string szPlotID, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE);

// use this function to rebuild the journal on oCreature using the bio DB
// a good place is the Module OnClientEnter() event
void RebuildJournalQuestEntries(object oCreature);

// retrieve persistent quest state from the DB
// - szPlotID: the plot identifier used in the toolset's Journal Editor
int RetrieveQuestState(string szPlotID, object oCreature);

// retrieves the lowest quest state on any of the PC's party
int PQJ_RetrieveLowestPartyQuestState(object oPC,string szPlotID);

// retrieves the highest quest state on any of the PC's party
int PQJ_RetrieveHighestPartyQuestState(object oPC,string szPlotID);
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

void RebuildJournalQuestEntries(object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  sPlayerAcct = ACR_SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = ACR_SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "'";

    string sSQL = "SELECT szPlotID, szPlotState FROM " + PQJ_TABLE + " WHERE" + playerSQL;
    ACR_SQLQuery(sSQL);
    int rs = ACR_SQLFetch();
     while(rs == SQL_SUCCESS)
     {
        string questID    = ACR_SQLGetData(1);
        string questState = ACR_SQLGetData(2);

      AddJournalQuestEntry(questID, StringToInt(questState), oCreature, FALSE, FALSE);

        rs = ACR_SQLFetch();
     }
  }
}

void StoreQuestEntry(string szPlotID, int nState, object oCreature, int bAllowOverrideHigher=FALSE)
{
  if(GetIsPC(oCreature))
  {

    string  journalSQL;
    string  sPlayerAcct = ACR_SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = ACR_SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "' AND szPlotID='" + szPlotID + "'";

    string sSQL = "SELECT szPlotState FROM " + PQJ_TABLE + " WHERE" + playerSQL;

    ACR_SQLQuery(sSQL);
    int rs = ACR_SQLFetch();
     if(rs == SQL_SUCCESS)
     {
        string journalSQL = "UPDATE " + PQJ_TABLE + " SET szPlotState = '" + IntToString(nState) + "' WHERE" + playerSQL;

        ACR_SQLQuery(journalSQL);
     }
     else
     {
        string fieldsSQL = " (player_acct,player_character, szPlotID, szPlotState) ";
        string valueSQL  = " ('" + sPlayerAcct + "','" + sPlayerChar + "','" + szPlotID + "','"  + IntToString(nState) + "')";
        string journalSQL = "INSERT INTO " + PQJ_TABLE + fieldsSQL + "VALUES" + valueSQL;

        ACR_SQLQuery(journalSQL);
     }
  }
}


void AddPersistentJournalQuestEntry(string szPlotID, int nState, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE, int bAllowOverrideHigher=FALSE)
{
  // standard nwn AddJournalQuestEntry function call
  AddJournalQuestEntry(szPlotID, nState, oCreature, bAllPartyMembers, bAllPlayers, bAllowOverrideHigher);
  // after standard functional call begin logic for database storing of data
  if(bAllPlayers)
  {
    // all players
    object oPC = GetFirstPC();
    while(GetIsObjectValid(oPC))
    {
      if(GetIsPC(oPC)) StoreQuestEntry(szPlotID, nState, oPC, bAllowOverrideHigher);
      oPC = GetNextPC();
    }
  }
  else if(bAllPartyMembers)
  {
    // all party members
    object oPartyMember = GetFirstFactionMember(oCreature, TRUE);
    while (GetIsObjectValid(oPartyMember))
    {
      StoreQuestEntry(szPlotID, nState, oPartyMember, bAllowOverrideHigher);
      oPartyMember = GetNextFactionMember(oCreature, TRUE);
    }
  }
  else
  {
    StoreQuestEntry(szPlotID, nState, oCreature, bAllowOverrideHigher);
  }
}

void DeleteQuestEntry(string szPlotID, object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  sPlayerAcct = ACR_SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = ACR_SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "' AND szPlotID='" + szPlotID + "'";

    string sSQL = "DELETE FROM " + PQJ_TABLE + " WHERE" + playerSQL;

    ACR_SQLQuery(sSQL);
  }
}

void RemovePersistentJournalQuestEntry(string szPlotID, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE)
{
  RemoveJournalQuestEntry(szPlotID, oCreature, bAllPartyMembers, bAllPlayers);
  // store data
  if(bAllPlayers)
  {
    // all players
    object oPC = GetFirstPC();
    while(GetIsObjectValid(oPC))
    {
      if(GetIsPC(oPC))   DeleteQuestEntry(szPlotID, oPC);
      oPC = GetNextPC();
    }
  }
  else if(bAllPartyMembers)
  {
    // whole group
    object oPartyMember = GetFirstFactionMember(oCreature, TRUE);
    while (GetIsObjectValid(oPartyMember))
    {
      DeleteQuestEntry(szPlotID, oPartyMember);
      oPartyMember = GetNextFactionMember(oCreature, TRUE);
    }
  }
  else
  {
    // player only
    DeleteQuestEntry(szPlotID, oCreature);
  }
}

int RetrieveQuestState(string szPlotID, object oCreature)
{
  if(GetIsPC(oCreature))
  {
    string  sPlayerAcct = ACR_SQLEncodeSpecialChars(GetPCPlayerName(oCreature));
    string  sPlayerChar = ACR_SQLEncodeSpecialChars(GetName(oCreature));

    string playerSQL = " player_acct='" + sPlayerAcct + "' AND player_character='" + sPlayerChar + "' AND szPlotID='" + szPlotID + "'";

    string sSQL = "SELECT szPlotState FROM " + PQJ_TABLE + " WHERE" + playerSQL;

    ACR_SQLQuery(sSQL);
    int rs = ACR_SQLFetch();
     if(rs == SQL_SUCCESS)
     {
        string strQuestState = ACR_SQLGetData(1);
        return StringToInt(strQuestState);
     }
     else
     {
     return 0;
     }
  }
  return 0;
}

// retrieves the lowest quest state on any of the PC's party
int PQJ_RetrieveLowestPartyQuestState(object oPC,string szPlotID)
{
    int nLowestValue = RetrieveQuestState(szPlotID, oPC);
    int nValue;
    object oMember;

    oMember = GetFirstFactionMember(oPC);

    while (GetIsObjectValid(oMember))
    {
        nValue = RetrieveQuestState(szPlotID, oMember);
        if (nValue < nLowestValue) nLowestValue = nValue;
        oMember = GetNextFactionMember(oPC);
    }
    return nLowestValue;
}

// retrieves the highest quest state on any of the PC's party
int PQJ_RetrieveHighestPartyQuestState(object oPC,string szPlotID)
{
    int nHighestValue = 0;
    int nValue;
    object oMember;

    oMember = GetFirstFactionMember(oPC);

    while (GetIsObjectValid(oMember))
    {
        nValue = RetrieveQuestState(szPlotID, oMember);
        if (nValue > nHighestValue) nHighestValue = nValue;
        oMember = GetNextFactionMember(oPC);
    }
    return nHighestValue;
}
And it was good.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

NWNX MySQL Plugin V.0.0.8
(c) 2007 by Ingmar Stieger (Papillon)
visit us at http://www.nwnx.org
(built using mysql-5.0.27 source)

* Log level set to 2 (everything)
* Connecting to server x3mkungen.mine.nu
* Plugin initialized.
* Registering under function class SQL
* Executing: CREATE TABLE IF NOT EXISTS `areas` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`ServerID` smallint(8) UNSIGNED NOT NULL,`Name` varchar(64) NOT NULL,`Tag` varchar(64) NOT NULL,`Visits` int(10) UNSIGNED NOT NULL default 0,`X` smallint(5) default NULL,`Y` smallint(5) default NULL,`Z` smallint(5) default NULL,`IsSafe` bool NOT NULL default false,`IsInside` bool NOT NULL default false,`IsNatural` bool NOT NULL default false,PRIMARY KEY (`ID`), UNIQUE KEY (`ServerID`, `Tag`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `cdkeys` (`CDKey` varchar(8) NOT NULL,`IsBanned` bool NOT NULL default false,PRIMARY KEY (`CDKey`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `characters` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`ServerID` smallint(5) UNSIGNED NOT NULL,`PlayerID` mediumint(8) UNSIGNED NOT NULL,`Name` varchar(32) NOT NULL,`Level` tinyint(3) UNSIGNED NOT NULL default 1,`Race` tinyint(3) UNSIGNED NOT NULL,`Subrace` tinyint(3) UNSIGNED default NULL,`Deity` varchar(32) default NULL,`Gender` tinyint(3) UNSIGNED NOT NULL,`HP` smallint(5) UNSIGNED NOT NULL,`XP` mediumint(8) UNSIGNED NOT NULL default 0,`GP` int(10) UNSIGNED NOT NULL default 0,`Wealth` int(10) UNSIGNED NOT NULL default 0,`Ethics` tinyint(3) UNSIGNED NOT NULL,`Morals` tinyint(3) UNSIGNED NOT NULL,`Class1` smallint(5) UNSIGNED NOT NULL,`Level1` tinyint(3) UNSIGNED NOT NULL default 1,`Class2` smallint(5) UNSIGNED default NULL,`Level2` tinyint(3) UNSIGNED default NULL,`Class3` smallint(5) UNSIGNED default NULL,`Level3` tinyint(3) UNSIGNED default NULL,`STR` tinyint(3) UNSIGNED NOT NULL,`CON` tinyint(3) UNSIGNED NOT NULL,`DEX` tinyint(3) UNSIGNED NOT NULL,`INT` tinyint(3) UNSIGNED NOT NULL,`WIS` tinyint(3) UNSIGNED NOT NULL,`CHA` tinyint(3) UNSIGNED NOT NULL,`Location` varchar(128) default NULL,`Damage` smallint(5) UNSIGNED NOT NULL default 0,`Deaths` smallint(5) UNSIGNED NOT NULL default 0,`Status` int(10) UNSIGNED NOT NULL default 0,`IsOnline` bool NOT NULL default false,`IsDeleted` bool NOT NULL default false,`IsPlayable` bool NOT NULL default true,PRIMARY KEY (`ID`), UNIQUE KEY (`PlayerID`, `Name`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `ipaddress` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`CDKey` varchar(8) NOT NULL,`IPAddress` varchar(16) NOT NULL,`IsBanned` bool NOT NULL default false,PRIMARY KEY (`ID`), UNIQUE KEY (`CDKey`, `IPAddress`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `item_properties` (`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,`ItemProperty` smallint(5) NOT NULL,`Description` varchar(128) default NULL,`IsIllegal` bool NOT NULL default 0,PRIMARY KEY (`ID`), UNIQUE KEY (`ItemProperty`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `logs` (`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,`ServerID` smallint(5) UNSIGNED NOT NULL,`CharacterID` mediumint(11) UNSIGNED default NULL,`Event` varchar(32) NOT NULL,`Description` varchar(128) default NULL,`Date` timestamp NOT NULL default CURRENT_TIMESTAMP,PRIMARY KEY (`ID`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `players` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`CDKey` varchar(8) NOT NULL,`Name` varchar(32) NOT NULL,`FirstLogin` datetime,`LastLogin` datetime,`LastLogout` datetime,`Logins` int(10) UNSIGNED NOT NULL default 0,`TimeOnline` mediumint(8) UNSIGNED NOT NULL default 0,`IsDM` bool NOT NULL default false,`IsBanned` bool NOT NULL default false,PRIMARY KEY (`ID`), UNIQUE KEY(`CDKey`, `Name`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `pwdata` (`Name` varchar(64) NOT NULL,`Tag` varchar(64) NOT NULL,`Key` varchar(64) NOT NULL,`Value` varchar(128) default NULL,`Expiration` smallint(5) UNSIGNED NOT NULL default 0,`Last` timestamp NOT NULL default CURRENT_TIMESTAMP,PRIMARY KEY (`Name`, `Tag`, `Key`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `pwobject` (`Name` varchar(64) NOT NULL,`Tag` varchar(64) NOT NULL,`Key` varchar(64) NOT NULL,`Value` varchar(128) default NULL,`Expiration` smallint(5) UNSIGNED NOT NULL default 0,`Last` timestamp NOT NULL default CURRENT_TIMESTAMP,PRIMARY KEY (`Name`, `Tag`, `Key`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `servers` (`ID` smallint(5) UNSIGNED NOT NULL,`Name` varchar(64) NOT NULL,`IPAddress` varchar(21) NOT NULL,PRIMARY KEY (`ID`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `spelltrack` (`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,`CharacterID` mediumint(11) UNSIGNED NOT NULL,`Class` smallint(5) NOT NULL,`Uses` varchar(128) default NULL,PRIMARY KEY (`ID`), UNIQUE KEY (`CharacterID`, `Class`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,6) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,23) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '23) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (52) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (23) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,6) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (32) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,63) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '63) and IsIllegal=1' at line 1.
* Executing: SELECT szPlotID, szPlotState FROM Table_AutoQuestData WHERE player_acct='indio' AND player_character='Kadmaq Ebelless'
! SQL Error: Table 'nwnx.Table_AutoQuestData' doesn't exist.
* Executing: SELECT IsBanned FROM cdkeys WHERE CDKey='KA7HUU74'
* Executing: INSERT INTO cdkeys (CDKey, IsBanned) VALUES('KA7HUU74', 0)
* Executing: SELECT IsBanned FROM cdkeys WHERE CDKey='KA7HUU74'
* Executing: SELECT IsBanned FROM ipaddress WHERE CDKey='KA7HUU74'
* Executing: INSERT INTO ipaddress (CDKey, IPAddress, IsBanned) VALUES('KA7HUU74','10.1.1.2',0)
* Executing: SELECT ID, IsBanned FROM players WHERE CDKey='KA7HUU74' and Name='indio'
* Executing: INSERT INTO players (CDKey, Name, FirstLogin, LastLogin, Logins, IsDM, IsBanned) VALUES ('KA7HUU74','indio', now(), now(), 0, 0, 0)
* Executing: SELECT ID FROM players WHERE CDKey='KA7HUU74' and Name='indio'
* Returning: 15 (column 0)
* Executing: SELECT ID, IsDeleted, IsPlayable FROM characters WHERE PlayerID=15 and Name='Kadmaq Ebelless'
* Executing: 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 (0,15,'Kadmaq Ebelless',3,6,17,'No Deity',0,26,4810,528,15,85,8,4,255,1,0,0,14,10,16,14,8,15,0,0,1,0,1)
* Executing: SELECT ID, IsDeleted, IsPlayable FROM characters WHERE PlayerID=15 and Name='Kadmaq Ebelless'
* Returning: 0 (column 1)
* Returning: 1 (column 2)
* Returning: 62 (column 0)
* Executing: INSERT INTO logs (ServerID, CharacterID, Event, Description) VALUES (0,62,'Login','Character: Kadmaq Ebelless')
* Executing: SELECT Status FROM characters WHERE id=62
* Returning: 0 (column 0)
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: INSERT INTO pwdata (Name, Tag, `Key`, Value, Expiration) VALUES ('Kadmaq Ebelless','KA7HUU74','ACR_REST_LOGOUT_TIMER', '665322301', 0) ON DUPLICATE KEY UPDATE Value='665322301', Expiration=0
* Executing: UPDATE characters SET IsOnline=0 WHERE ID=62
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,6) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,23) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '23) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (52) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (23) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,6) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (32) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,63) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '63) and IsIllegal=1' at line 1.
* Executing: SELECT szPlotID, szPlotState FROM Table_AutoQuestData WHERE player_acct='indio' AND player_character='Kadmaq Ebelless'
! SQL Error: Table 'nwnx.Table_AutoQuestData' doesn't exist.
* Executing: SELECT IsBanned FROM cdkeys WHERE CDKey='KA7HUU74'
* Returning: 0 (column 0)
* Executing: SELECT IsBanned FROM ipaddress WHERE CDKey='KA7HUU74'
* Returning: 0 (column 0)
* Executing: SELECT ID, IsBanned FROM players WHERE CDKey='KA7HUU74' and Name='indio'
* Returning: 0 (column 1)
* Returning: 15 (column 0)
* Executing: SELECT ID, IsDeleted, IsPlayable FROM characters WHERE PlayerID=15 and Name='Kadmaq Ebelless'
* Returning: 0 (column 1)
* Returning: 1 (column 2)
* Returning: 62 (column 0)
* Executing: INSERT INTO logs (ServerID, CharacterID, Event, Description) VALUES (0,62,'Login','Character: Kadmaq Ebelless')
* Executing: SELECT Status FROM characters WHERE id=62
* Returning: 0 (column 0)
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: INSERT INTO pwdata (Name, Tag, `Key`, Value, Expiration) VALUES ('Kadmaq Ebelless','KA7HUU74','ACR_REST_LOGOUT_TIMER', '665322360', 0) ON DUPLICATE KEY UPDATE Value='665322360', Expiration=0
* Executing: UPDATE characters SET IsOnline=0 WHERE ID=62
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Looks like I followed the header too closely when defining the name of your quest table, turns out it wants to be called "Table_AutoQuestData" - so that part should be fixed now.

The item_properties error is a known issue, just haven't nailed it down (some acquired items are returning null on their GetItemPropertyType)- shouldn't be causing any loss of core function.

Your login is being reported as associated with server ID 0, did you get your acf_settings_i.nss file edited with the line :

Code: Select all

const int ACR_SERVER_ID = 3;
That's all my tired eyes see for now, maybe Cipher can spot some other maybes in there.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

No other errors I can spot on a cursory review. There are however some optimizations we can make, like replacing player_account and player_name in the schema with character ID (what we use to identify and track characters), but that's an issue of tighter integration and not directly related to this discussion. We can talk about that on Indio's quest thread.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

NWNX MySQL Plugin V.0.0.8
(c) 2007 by Ingmar Stieger (Papillon)
visit us at http://www.nwnx.org
(built using mysql-5.0.27 source)

* Log level set to 2 (everything)
* Connecting to server vault.alandfaraway.org
* Plugin initialized.
* Registering under function class SQL
* Executing: CREATE TABLE IF NOT EXISTS `areas` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`ServerID` smallint(8) UNSIGNED NOT NULL,`Name` varchar(64) NOT NULL,`Tag` varchar(64) NOT NULL,`Visits` int(10) UNSIGNED NOT NULL default 0,`X` smallint(5) default NULL,`Y` smallint(5) default NULL,`Z` smallint(5) default NULL,`IsSafe` bool NOT NULL default false,`IsInside` bool NOT NULL default false,`IsNatural` bool NOT NULL default false,PRIMARY KEY (`ID`), UNIQUE KEY (`ServerID`, `Tag`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `cdkeys` (`CDKey` varchar(8) NOT NULL,`IsBanned` bool NOT NULL default false,PRIMARY KEY (`CDKey`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `characters` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`ServerID` smallint(5) UNSIGNED NOT NULL,`PlayerID` mediumint(8) UNSIGNED NOT NULL,`Name` varchar(32) NOT NULL,`Level` tinyint(3) UNSIGNED NOT NULL default 1,`Race` tinyint(3) UNSIGNED NOT NULL,`Subrace` tinyint(3) UNSIGNED default NULL,`Deity` varchar(32) default NULL,`Gender` tinyint(3) UNSIGNED NOT NULL,`HP` smallint(5) UNSIGNED NOT NULL,`XP` mediumint(8) UNSIGNED NOT NULL default 0,`GP` int(10) UNSIGNED NOT NULL default 0,`Wealth` int(10) UNSIGNED NOT NULL default 0,`Ethics` tinyint(3) UNSIGNED NOT NULL,`Morals` tinyint(3) UNSIGNED NOT NULL,`Class1` smallint(5) UNSIGNED NOT NULL,`Level1` tinyint(3) UNSIGNED NOT NULL default 1,`Class2` smallint(5) UNSIGNED default NULL,`Level2` tinyint(3) UNSIGNED default NULL,`Class3` smallint(5) UNSIGNED default NULL,`Level3` tinyint(3) UNSIGNED default NULL,`STR` tinyint(3) UNSIGNED NOT NULL,`CON` tinyint(3) UNSIGNED NOT NULL,`DEX` tinyint(3) UNSIGNED NOT NULL,`INT` tinyint(3) UNSIGNED NOT NULL,`WIS` tinyint(3) UNSIGNED NOT NULL,`CHA` tinyint(3) UNSIGNED NOT NULL,`Location` varchar(128) default NULL,`Damage` smallint(5) UNSIGNED NOT NULL default 0,`Deaths` smallint(5) UNSIGNED NOT NULL default 0,`Status` int(10) UNSIGNED NOT NULL default 0,`IsOnline` bool NOT NULL default false,`IsDeleted` bool NOT NULL default false,`IsPlayable` bool NOT NULL default true,PRIMARY KEY (`ID`), UNIQUE KEY (`PlayerID`, `Name`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `ipaddress` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`CDKey` varchar(8) NOT NULL,`IPAddress` varchar(16) NOT NULL,`IsBanned` bool NOT NULL default false,PRIMARY KEY (`ID`), UNIQUE KEY (`CDKey`, `IPAddress`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `item_properties` (`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,`ItemProperty` smallint(5) NOT NULL,`Description` varchar(128) default NULL,`IsIllegal` bool NOT NULL default 0,PRIMARY KEY (`ID`), UNIQUE KEY (`ItemProperty`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `logs` (`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,`ServerID` smallint(5) UNSIGNED NOT NULL,`CharacterID` mediumint(11) UNSIGNED default NULL,`Event` varchar(32) NOT NULL,`Description` varchar(128) default NULL,`Date` timestamp NOT NULL default CURRENT_TIMESTAMP,PRIMARY KEY (`ID`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `players` (`ID` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,`CDKey` varchar(8) NOT NULL,`Name` varchar(32) NOT NULL,`FirstLogin` datetime,`LastLogin` datetime,`LastLogout` datetime,`Logins` int(10) UNSIGNED NOT NULL default 0,`TimeOnline` mediumint(8) UNSIGNED NOT NULL default 0,`IsDM` bool NOT NULL default false,`IsBanned` bool NOT NULL default false,PRIMARY KEY (`ID`), UNIQUE KEY(`CDKey`, `Name`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `pwdata` (`Name` varchar(64) NOT NULL,`Tag` varchar(64) NOT NULL,`Key` varchar(64) NOT NULL,`Value` varchar(128) default NULL,`Expiration` smallint(5) UNSIGNED NOT NULL default 0,`Last` timestamp NOT NULL default CURRENT_TIMESTAMP,PRIMARY KEY (`Name`, `Tag`, `Key`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `pwobject` (`Name` varchar(64) NOT NULL,`Tag` varchar(64) NOT NULL,`Key` varchar(64) NOT NULL,`Value` varchar(128) default NULL,`Expiration` smallint(5) UNSIGNED NOT NULL default 0,`Last` timestamp NOT NULL default CURRENT_TIMESTAMP,PRIMARY KEY (`Name`, `Tag`, `Key`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `servers` (`ID` smallint(5) UNSIGNED NOT NULL,`Name` varchar(64) NOT NULL,`IPAddress` varchar(21) NOT NULL,PRIMARY KEY (`ID`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: CREATE TABLE IF NOT EXISTS `spelltrack` (`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,`CharacterID` mediumint(11) UNSIGNED NOT NULL,`Class` smallint(5) NOT NULL,`Uses` varchar(128) default NULL,PRIMARY KEY (`ID`), UNIQUE KEY (`CharacterID`, `Class`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,6) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,23) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '23) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (52) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (23) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,6) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (32) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,63) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '63) and IsIllegal=1' at line 1.
* Executing: SELECT szPlotID, szPlotState FROM Table_AutoQuestData WHERE player_acct='indio' AND player_character='Kadmaq Ebelless'
* Executing: SELECT IsBanned FROM cdkeys WHERE CDKey='KA7HUU74'
* Returning: 0 (column 0)
* Executing: SELECT IsBanned FROM ipaddress WHERE CDKey='KA7HUU74'
* Returning: 0 (column 0)
* Executing: SELECT ID, IsBanned FROM players WHERE CDKey='KA7HUU74' and Name='indio'
* Returning: 0 (column 1)
* Returning: 1 (column 0)
* Executing: SELECT ID, IsDeleted, IsPlayable FROM characters WHERE PlayerID=1 and Name='Kadmaq Ebelless'
* Returning: 0 (column 1)
* Returning: 1 (column 2)
* Returning: 1 (column 0)
* Executing: INSERT INTO logs (ServerID, CharacterID, Event, Description) VALUES (0,1,'Login','Character: Kadmaq Ebelless')
* Executing: SELECT Status FROM characters WHERE id=1
* Returning: 0 (column 0)
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: INSERT INTO pwdata (Name, Tag, `Key`, Value, Expiration) VALUES ('Kadmaq Ebelless','KA7HUU74','ACR_REST_LOGOUT_TIMER', '665322301', 0) ON DUPLICATE KEY UPDATE Value='665322301', Expiration=0
* Executing: UPDATE characters SET IsOnline=0 WHERE ID=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (52) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (1) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (1) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,52) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '52) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (1) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (80) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,63) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '63) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (55) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (70) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (1) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (1) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,63) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '63) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (,63) and IsIllegal=1
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '63) and IsIllegal=1' at line 1.
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: SELECT szPlotID, szPlotState FROM Table_AutoQuestData WHERE player_acct='AcadiusLost' AND player_character='Bexley Normenhurst III'
* Executing: SELECT IsBanned FROM cdkeys WHERE CDKey='KCMFYULH'
* Executing: INSERT INTO cdkeys (CDKey, IsBanned) VALUES('KCMFYULH', 0)
* Executing: SELECT IsBanned FROM cdkeys WHERE CDKey='KCMFYULH'
* Executing: SELECT IsBanned FROM ipaddress WHERE CDKey='KCMFYULH'
* Executing: INSERT INTO ipaddress (CDKey, IPAddress, IsBanned) VALUES('KCMFYULH','67.172.180.55',0)
* Executing: SELECT ID, IsBanned FROM players WHERE CDKey='KCMFYULH' and Name='AcadiusLost'
* Executing: INSERT INTO players (CDKey, Name, FirstLogin, LastLogin, Logins, IsDM, IsBanned) VALUES ('KCMFYULH','AcadiusLost', now(), now(), 0, 0, 0)
* Executing: SELECT ID FROM players WHERE CDKey='KCMFYULH' and Name='AcadiusLost'
* Returning: 2 (column 0)
* Executing: SELECT ID, IsDeleted, IsPlayable FROM characters WHERE PlayerID=2 and Name='Bexley Normenhurst III'
* Executing: 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 (0,2,'Bexley Normenhurst III',4,6,17,'Tymora',0,28,6081,1258,15,85,8,255,255,1,0,0,12,12,19,14,8,10,0,0,1,0,1)
* Executing: SELECT ID, IsDeleted, IsPlayable FROM characters WHERE PlayerID=2 and Name='Bexley Normenhurst III'
* Returning: 0 (column 1)
* Returning: 1 (column 2)
* Returning: 2 (column 0)
* Executing: INSERT INTO logs (ServerID, CharacterID, Event, Description) VALUES (0,2,'Login','Character: Bexley Normenhurst III')
* Executing: SELECT Status FROM characters WHERE id=2
* Returning: 0 (column 0)
* Executing: SELECT ID FROM item_properties WHERE ItemProperty in (15) and IsIllegal=1
* Executing: INSERT INTO pwdata (Name, Tag, `Key`, Value, Expiration) VALUES ('Bexley Normenhurst III','KCMFYULH','ACR_REST_LOGOUT_TIMER', '665322360', 0) ON DUPLICATE KEY UPDATE Value='665322360', Expiration=0
* Executing: UPDATE characters SET IsOnline=0 WHERE ID=2
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

After some tinkering, we seemed to have the DB access working when we circumvented the csf scripts and went straight to the acf ones.

May not be the last word on this, but progress at least.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Ok, I've nailed down the lag to that pesky script you ALFAtized on the 2nd day, AL.

Could you do an analysis of that script and see what might be causing it to lag 03? It feels like loop-induced lag...the script looking for something that it's not finding and so infinitely retrying.

To identify the cause of the lag I simply deleted that script, ran the module, and it was back to normal.
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

That script is defining a number of quest-related functions- where are they being called? Do you still have extra code in your acf onmoduleload file that initializes the system, or anything onheartbeat that tries to update it? I'm having trouble seeing how it could be causing recurring lag, as those functions should only really be being called when a quest is taken, when one is completed, etc. (other than the module loading case, or maybe client enter?)

I might be able to free up some time to wrestle with it this weekend, it's hard to secondguess this kind of thing without access to the module in the toolset.

Do you see lots of recurring SQL traffic to the quest table in your xp_mysql.txt log file, when you set it to log everything?
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Lag problem isn't a problem any more. Seems like my modified ACR_CLientEnter which incorporated the quest system failed to be copied to my main module properly.

But we're not out of the woods yet. Quests aren't working any longer. Could you take a look at the database AL and see if Kadmaq Ebeless has any variables assigned to him? I've accepted some quests, but the quests aren't being recognised by the quest recipient.
Image
Locked