View previous topic :: View next topic |
Author |
Message |
Der Phobos
Joined: 07 Nov 2006 Posts: 14
|
Posted: Tue Nov 28, 2006 3:56 Post subject: Troubles calling data back into nwn |
|
|
I'm using the basic scripts supplied with nwnx, trying to call a speakstring of what I exported, however its not calling it back into the module. I built a php page to verify that the data is correct and that I am brining in proper data. The page displays the results I wrote just as they should be, however nwn cant call back the string. Anyone have any ideas of where to begin debuging, or any tricks? |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Tue Nov 28, 2006 7:23 Post subject: Re: Troubles calling data back into nwn |
|
|
Der Phobos wrote: | I'm using the basic scripts supplied with nwnx, trying to call a speakstring of what I exported, however its not calling it back into the module. I built a php page to verify that the data is correct and that I am brining in proper data. The page displays the results I wrote just as they should be, however nwn cant call back the string. Anyone have any ideas of where to begin debuging, or any tricks? |
Please post your code that you are using to read in the data from the database. Then we can try to help you troubleshoot it. _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
Der Phobos
Joined: 07 Nov 2006 Posts: 14
|
Posted: Tue Nov 28, 2006 7:39 Post subject: |
|
|
string sVar = GetPersistentString(oPC, "Highland Saga");
SpeakString(sVar, TALKVOLUME_SHOUT);
string GetPersistentString(object oObject, string sVarName, string sTable = "pwdata")
{
string sPlayer;
string sTag;
if (GetIsPC(oObject))
{
sPlayer = SQLEncodeSpecialChars(GetPCPlayerName(oObject));
sTag = SQLEncodeSpecialChars(GetName(oObject));
}
else
{
sPlayer = "~";
sTag = GetTag(oObject);
}
sVarName = SQLEncodeSpecialChars(sVarName);
string sSQL = "SELECT val FROM " + sTable + " WHERE player='" + sPlayer +
"' AND tag='" + sTag + "' AND name='" + sVarName + "'";
SQLExecDirect(sSQL);
if (SQLFetch() == SQL_SUCCESS)
return SQLDecodeSpecialChars(SQLGetData(1));
else
{
return "";
// If you want to convert your existing persistent data to SQL, this
// would be the place to do it. The requested variable was not found
// in the database, you should
// 1) query it's value using your existing persistence functions
// 2) save the value to the database using SetPersistentString()
// 3) return the string value here.
}
} _________________ Highland Saga: Black Dawn |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Tue Nov 28, 2006 9:09 Post subject: |
|
|
The easiest way to find problems like this is to enable full logging (level 2) in nwnx.ini and then have a look at the generated SQL statements. You can easily compare the SELECT to the actual data in the database, and see why no data is coming back. _________________ Papillon |
|
Back to top |
|
|
Der Phobos
Joined: 07 Nov 2006 Posts: 14
|
|
Back to top |
|
|
caloup
Joined: 29 Sep 2006 Posts: 59 Location: albi (france)
|
Posted: Tue Nov 28, 2006 15:06 Post subject: HELLO |
|
|
You should call the function AFTER the define of this function, i think :
Quote: |
string GetPersistentString(object oObject, string sVarName, string sTable = "pwdata")
{
string sPlayer;
string sTag;
if (GetIsPC(oObject))
{
sPlayer = SQLEncodeSpecialChars(GetPCPlayerName(oObject));
sTag = SQLEncodeSpecialChars(GetName(oObject));
}
else
{
sPlayer = "~";
sTag = GetTag(oObject);
}
sVarName = SQLEncodeSpecialChars(sVarName);
string sSQL = "SELECT val FROM " + sTable + " WHERE player='" + sPlayer +
"' AND tag='" + sTag + "' AND name='" + sVarName + "'";
SQLExecDirect(sSQL);
if (SQLFetch() == SQL_SUCCESS)
return SQLDecodeSpecialChars(SQLGetData(1));
else
{
return "";
// If you want to convert your existing persistent data to SQL, this
// would be the place to do it. The requested variable was not found
// in the database, you should
// 1) query it's value using your existing persistence functions
// 2) save the value to the database using SetPersistentString()
// 3) return the string value here.
}
}
void main()
{
string sVar = GetPersistentString(oPC, "Highland Saga");
SpeakString(sVar, TALKVOLUME_SHOUT);
}
|
|
|
Back to top |
|
|
Der Phobos
Joined: 07 Nov 2006 Posts: 14
|
Posted: Tue Nov 28, 2006 18:29 Post subject: |
|
|
first off they were in two diffrent scripts, one with an include of the sql_include.
Second the problem was something I tried setting up before I remembered that nwn doesnt realy have array objects. A script I thought I had removed but had not and was goofing everything up. _________________ Highland Saga: Black Dawn |
|
Back to top |
|
|
|