Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Item DataBase (https://forums.graalonline.com/forums/showthread.php?t=134265357)

callimuc 12-22-2011 10:51 PM

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.

Gunderak 12-23-2011 03:07 AM

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.

DustyPorViva 12-23-2011 03:17 AM

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.

fowlplay4 12-23-2011 03:26 AM

Quote:

Originally Posted by Gunderak (Post 1679179)
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".

DeCeaseD 12-23-2011 04:56 AM

Quote:

Originally Posted by fowlplay4 (Post 1679182)
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?

DustyPorViva 12-23-2011 05:38 AM

Quote:

Originally Posted by DeCeaseD (Post 1679189)
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.

callimuc 12-23-2011 04:00 PM

Ok thanks guys. I will look around for those stuff (MUDlib and so on) and mess around with that ;)

Mark Sir Link 12-23-2011 04:47 PM

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.


All times are GMT +2. The time now is 08:24 PM.

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