Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-22-2015, 11:15 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Databases and text file usages

It was mentioned that using DB NPCs and text files were better to save information like guilds rather than using clientr flags. Is the usage between the two preference?

IE: Choosing DB over text files or clientr.

And what are all the advantages of using the two methods?

Just looking to get the most information out of these methods that I can. Thanks for any assistance.
Reply With Quote
  #2  
Old 02-23-2015, 03:22 AM
Elk Elk is offline
Sr Marketing Strategist
Elk's Avatar
Join Date: Nov 2005
Location: Deerland
Posts: 3,829
Elk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant future
Send a message via ICQ to Elk Send a message via AIM to Elk Send a message via MSN to Elk Send a message via Yahoo to Elk
i guess clientr isnt as easy to control as txt :0 as client flags are stored individually within player attributes... has a better structure and the source to read is only one then, instead of having the flags all scrambled over accross different accounts

DB NPCs?...
__________________
iEra IGN: *Elk (Darkshire)
iCla. IGN: *Elk (Darkshire)
iZone IGN: *Elk (Darkshire)





Last edited by Elk; 02-23-2015 at 03:41 AM..
Reply With Quote
  #3  
Old 02-23-2015, 04:40 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Sorry for any confusion, I just mean databases.

Edit: just to say I've never used text files before, so getting into them is new for me. And I'm just getting the hang of using Databases
Reply With Quote
  #4  
Old 02-23-2015, 07:06 AM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is just really niceMysticalDragon is just really nice
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
Quote:
Originally Posted by khortez View Post
It was mentioned that using DB NPCs and text files were better to save information like guilds rather than using clientr flags. Is the usage between the two preference?

IE: Choosing DB over text files or clientr.

And what are all the advantages of using the two methods?

Just looking to get the most information out of these methods that I can. Thanks for any assistance.
Honestly, its faster to store them in clientr. variables. But the choice really comes down to what features you plan to add? Do you plan on having GUI Profiles, where you can look up other guilds or are you only storing personal data? You could use a combination of both really, cache the information from SQL and store it on the player for a faster process.
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote
  #5  
Old 02-23-2015, 02:11 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
text files are wack, store everthing in .bmp images and code your own OCR.
Reply With Quote
  #6  
Old 02-23-2015, 04:39 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by MysticalDragon View Post
Honestly, its faster to store them in clientr. variables. But the choice really comes down to what features you plan to add? Do you plan on having GUI Profiles, where you can look up other guilds or are you only storing personal data? You could use a combination of both really, cache the information from SQL and store it on the player for a faster process.
Wouldn't even know where to begin with SQL(never used it/learned it before). But I could use a mixture of different methods? IE: clientr. + DB/textfiles?

Hmm, I'll just make this part easy and say I really wouldn't know the best method then lol. I do plan on adding a lot of features.
Reply With Quote
  #7  
Old 02-24-2015, 05:45 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Imagine you wish to find a list of all players in a certain guild. If you store the guild as a clientr variable (like clientr.guild=Vimes), then if you wanted to list all players in Vimes, you need to search every player who has ever logged on to the server. (This is impractically slow for most uses.)

If you store it in a text file or DB NPC, you could instead store an array guild.Vimes=cbk1994,Seeya and easily get that list.

Quote:
Originally Posted by khortez View Post
But I could use a mixture of different methods? IE: clientr. + DB/textfiles?
You could, but beware problems which might result in inconsistent data between the two. Imagine you open a player's attributes via RC, they join a guild, then you save their attibutes. The DB NPC will have been updated, but not the player flags. Having a single source of data helps to keep things consistent and prevent subtle bugs.
__________________
Reply With Quote
  #8  
Old 02-24-2015, 03:23 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
Imagine you wish to find a list of all players in a certain guild. If you store the guild as a clientr variable (like clientr.guild=Vimes), then if you wanted to list all players in Vimes, you need to search every player who has ever logged on to the server. (This is impractically slow for most uses.)

If you store it in a text file or DB NPC, you could instead store an array guild.Vimes=cbk1994,Seeya and easily get that list.



You could, but beware problems which might result in inconsistent data between the two. Imagine you open a player's attributes via RC, they join a guild, then you save their attibutes. The DB NPC will have been updated, but not the player flags. Having a single source of data helps to keep things consistent and prevent subtle bugs.
Ah, I think I understand that. Thanks everyone
Reply With Quote
  #9  
Old 02-24-2015, 03:55 PM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is just really niceMysticalDragon is just really nice
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
Quote:
Originally Posted by khortez View Post
Ah, I think I understand that. Thanks everyone
Don't use DB NPCs to store guild data, later on you will regret that decision.
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote
  #10  
Old 02-24-2015, 04:07 PM
Tim_Rocks Tim_Rocks is offline
a true gentlemen
Tim_Rocks's Avatar
Join Date: Aug 2008
Location: USA
Posts: 1,863
Tim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to behold
Quote:
Originally Posted by MysticalDragon View Post
Don't use DB NPCs to store guild data, later on you will regret that decision.
Yeah, use SQL. Works wonders for guild related system. It's convienant especially when players are offline. If you want to edit a players rank, remove them, or send invites. Just update a row in your SQL database.
__________________
Reply With Quote
  #11  
Old 02-24-2015, 06:29 PM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by Tim_Rocks View Post
Yeah, use SQL. Works wonders for guild related system. It's convienant especially when players are offline. If you want to edit a players rank, remove them, or send invites. Just update a row in your SQL database.
If SQL is the best way.. My only question would be, where would I begin learning it? Chompy gave me his source. but if anyone has other sources Id be happy to look at them all
Reply With Quote
  #12  
Old 02-24-2015, 07:24 PM
Tim_Rocks Tim_Rocks is offline
a true gentlemen
Tim_Rocks's Avatar
Join Date: Aug 2008
Location: USA
Posts: 1,863
Tim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to behold
Honestly, setting it up is really easy. I'd lookup SQLite and take tutorials on it. There's not a lot that's different other than syntax. I'm sure others here have really great resources to provide.
__________________
Reply With Quote
  #13  
Old 02-25-2015, 02:49 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Basically you should do what Tim just said. Thats great advice since graal uses sqlite. However if you want you can go to youtube and watch a few video tutorials. Then head over the W3 School's and look up query examples. You would be surprised how much even those of us who know this stuff have to constantly look back at references. As long as you kinda get the idea of how it works you should be fine. If you want, for extra credit you can look up advanced sql techniques such as the logic data modeling that I learned about a few years ago and theres plenty of other optimizations you can do however just the basics will work very well with graal
Reply With Quote
  #14  
Old 02-25-2015, 05:26 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by MysticalDragon View Post
Don't use DB NPCs to store guild data, later on you will regret that decision.
Perfect is the enemy of the good. Even better to design your code so you can swap out the implementation easily, should you want to, in the future.
__________________
Reply With Quote
  #15  
Old 02-26-2015, 12:23 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by scriptless View Post
Basically you should do what Tim just said. Thats great advice since graal uses sqlite. However if you want you can go to youtube and watch a few video tutorials. Then head over the W3 School's and look up query examples. You would be surprised how much even those of us who know this stuff have to constantly look back at references. As long as you kinda get the idea of how it works you should be fine. If you want, for extra credit you can look up advanced sql techniques such as the logic data modeling that I learned about a few years ago and theres plenty of other optimizations you can do however just the basics will work very well with graal
will do the best i can. though i wish the information wasn't such a pain to reach. learning to code in itself is an animal, especially with information in every which way. and then there's SQL... but regardless the advice and help from everyone is much appreciated. i'll do what i have to to get what i need done
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:12 PM.


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