Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-22-2011, 10:51 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Item DataBase

Well I have seen on several threads, heard from several people and realized on several servers that an ´Item-DataBase´ seems to be something good.
I wanted to try also making such a thing but how exactly are they made? Like is everything bumped in an array (doesn´t seem to be good in my oppinion)?
PHP Code:
this.items = {weapon, {statsmore stats, ...}, weapon2, {statsmore stats, ...}, ...}; 
Is it prefered to make them like
PHP Code:
this.item0001 = {weaponinfodamageimageiconmore stats, ....};
this.item0002 = {"skip""ani"NULL"skip.png""skip-icon.png", {"chat""funny"}, ....};
.... 
Can anyone maybe tell me some goods and bads about that, maybe give me an example and how they should be used and stuff? No I´m not asking for a full code, just never saw/worked with such a system so I want to see how to work with it.

I do know that everything is stored in a DB.
__________________
MEEP!

Last edited by callimuc; 12-22-2011 at 10:57 PM.. Reason: Database
Reply With Quote
  #2  
Old 12-23-2011, 03:07 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Use SQLITE for an item db, or even a DBNPC and then have method of sending and retrieving data from it.
That would be an even better item system.

One bad thing about what you're currently using, this. variables as soon as you restart graal it's value will be reset to null.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 12-23-2011, 03:17 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Only use SQLite for a DB if you're going to actually learn how to use it securely and efficiently. If you're not going to bother doing it right or to debug it, it's going to be slow and insecure.
Reply With Quote
  #4  
Old 12-23-2011, 03:26 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Gunderak View Post
Use SQLITE for an item db, or even a DBNPC and then have method of sending and retrieving data from it.
That would be an even better item system.

One bad thing about what you're currently using, this. variables as soon as you restart graal it's value will be reset to null.
Ignore him he doesn't know what he's talking about.

SQL, NPC Flags, Files are all just storage for the item data. Establish a basic item system first:

For tracking the quantity of the item:
clientr.item.("item name") = quantity

Store item data in a DB:
this.("item name") = {item, data};

For making the data of the weapon accessible to your client-side scripts set the following as needed in player flags (this should be a mirror of your DB data):
clientr.data.("item name") = {item, data}

Search MUDlib on the forums for discussion on the topic of "item systems".
__________________
Quote:
Reply With Quote
  #5  
Old 12-23-2011, 04:56 AM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Quote:
Originally Posted by fowlplay4 View Post
Ignore him he doesn't know what he's talking about.

SQL, NPC Flags, Files are all just storage for the item data. Establish a basic item system first:

For tracking the quantity of the item:
clientr.item.("item name") = quantity

Store item data in a DB:
this.("item name") = {item, data};

For making the data of the weapon accessible to your client-side scripts set the following as needed in player flags (this should be a mirror of your DB data):
clientr.data.("item name") = {item, data}

Search MUDlib on the forums for discussion on the topic of "item systems".
For my first item system DB I actually did it so that a players items were stored in a DB, than the information was retrieved via an item info DB since I found that items in client flags tend to become a bit wholesome after awhile, just wondering if it was a bad thing to do it this way?
Reply With Quote
  #6  
Old 12-23-2011, 05:38 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by DeCeaseD View Post
For my first item system DB I actually did it so that a players items were stored in a DB, than the information was retrieved via an item info DB since I found that items in client flags tend to become a bit wholesome after awhile, just wondering if it was a bad thing to do it this way?
You need a way to easily access the item data on the clientside, yet be secure on the serverside. Clientr strings are the only way to do this.
Reply With Quote
  #7  
Old 12-23-2011, 04:00 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Ok thanks guys. I will look around for those stuff (MUDlib and so on) and mess around with that
__________________
MEEP!
Reply With Quote
  #8  
Old 12-23-2011, 04:47 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
babby's first item storage might work well by just using classes in which all fields are defined as own variable and saving/loading as JSON.
Reply With Quote
Reply


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


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