View previous topic :: View next topic |
Author |
Message |
Urthen
Joined: 29 May 2005 Posts: 1 Location: Maine
|
Posted: Sun May 29, 2005 6:24 Post subject: Problems... |
|
|
Allright, I wont spend too much time moping. This doesnt work. I have NO idea why. I have gotten similar statements to work in the past. Basically, this function is called in the onDeath script of any dying NPC to create loot on it. I have created the table in the database correctly of course.
Code: | void makeLoot(object oDropper, string sTable) {
//Support for monsters with no loot type
if(sTable == "")
return;
//string sQuery = "insert into loottables values('stuff', 1, 2, '45 35 75', '1 1 1', '1 1 1', '*sword *ammo *bow');";
string sQuery = "select minitems, maxitems, probability, minstack, maxstack, resref from loottables where loottype='" + sTable + "'";
SQLExecDirect(sQuery);
//If there was an error (Probably invalid loot table)
if(SQLFetch() == SQL_SUCCESS)
{
//Stuff that doesnt matter cause its not executed due to buggage.
} else {
AssignCommand(oDropper, SpeakString("I wasnt able to get a loot table! Poor me..." + sQuery));
return;
} |
Now, this is what the log says:
Code: | o Logfile maximum size limit is: 524288 bytes
o Log level: Everything will be logged.
o Using MySQL connection.
o Hooking SCO....hooked at 5c4320
o Hooking RCO....hooked at 5c4200
o Connect successful.
o Got request: select minitems, maxitems, probability, minstack, maxstack, resref from loottables where loottype='sword'
o Disconnecting from database. |
I know its not the semicolon at the end of the query, it doesnt work whether I put it in or not. The commented out insert query is to see if that works: It does.
If I copy and paste the request directly from the logfile into MySQL Query Browser, it will execute and return the correct row.
Yet SQLFetch() always seems to return SQL_ERROR.
ARgggg! |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun May 29, 2005 10:31 Post subject: |
|
|
I'm not sure what the reason for this behaviour is, but between those lines:
Code: | o Got request: select minitems, maxitems, probability, minstack, maxstack, resref from loottables where loottype='sword'
o Disconnecting from database. |
there should be a line:
Code: | o Sent response (nn bytes): xyz
|
It looks like as if SQLFetch in aps_include is not doing what it should do. Are there any modifications in that file ? _________________ Papillon |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|