Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-14-2013, 09:25 PM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Some SQL / db Questions...

So I am trying to set up a db that stores two lists specific to a user in regards to quests they have completed, or not completed. I figure this could be used as a db for item storage if need be, but this was the simplest purpose I could think of.

ex column names:
owner , complete, incomplete

First question:
Would it be best to associate the owner by player.account or player.communityname ? I am currently using player.account.


Second Question / my issue..:
As far as how data is stored in a single column, if there are multiple things (ex: inc1, inc2) I have written a function to gather that data:

PHP Code:
/*-------- getQuestsIncomplete------------
getQuestsIncomplete(temp.owner)
only for incomplete quests right now**
Set arguments: incomplete , quest_users
-----------------------------------*/

function getQuestsIncomplete(temp.owner)

  
temp.check escapestring2(temp.owner);
  
temp.statement "SELECT incomplete FROM quest_users WHERE owner = '"@temp.check@"' ";
  
  
//Query
  
temp.req requestSQL(temp.statement,true);
  
  
//Does this exist?
  
if (temp.req.rows.size() == 0)
    {
      return 
NULL;
    }
  return 
temp.req.rows[0][0]; 

this will return inc1, inc2 without any " ".

If I write another function to update that list, I've tried adding to it as if it was an array, and any time I do, it just returns 0 afterwards (Echoing in rc).

This was an issue I was anticipating as I will eventually store a lot of information in a single column, which could be a bad design, but I would appreciate some insight on how to get this functioning if I am doing something wrong. Or, a better method for this wouldn't hurt either.

Thanks.

Edit: wanted to include what I'm going to use this for later on...

I was going to set up a GUI for the user to pull a list of quests they have either completed or not completed from.

The names will be internal names for a separate db that stores all the quest specific info to display once a user had selected that quest.
__________________
Quote:
Originally posted by Spark910
Think befreo you type.

Last edited by Torankusu; 12-14-2013 at 11:47 PM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.