![]() |
looking up db flags
This is probably more of a logic question. I have a wnpc that needs to look up the flags on a db npc. The thing is Im not sure how to.
The flags in the dbnpc are set up as category_playeraccountname_itemname, and I need to first use a trigger to lookup and see if the selected category in a gui is the same as the first part of the flag only, then use the account name and item name somewhere else in the wnpc. I have the category selection and gui and all that done, but just not sure how to even go about doing this. e.g. someone selects the category weapons, so it searches the flags in dbnpc for the first part of the flag name weapons, then puts up who owns it, and the actual name of the weapon. weapons_sssssssssss_sword={other stuff here i need to pull up eventually too} hope this makes sense. |
I'm still a little confused what specifically your attempting to do here.
But as for accessing information stored in a dbnpc, I recommend making public functions in the dbnpc and calling them to get what you need. PHP Code:
|
I think the first part of what you did will help.
Basically the var is category_accountname_itemname={itemimg,itemprice,i temposteddate,itemexpiresdate} so something like: weapons_sssssssssss_sword={sword2.png,10,06042010, 06052010} but in the gui, they select a category first, then it pops up: item name item image seller(accountname) end date just dont know how to search the dbnpc to first pull up category, then post the stuff right above here according to each category selected. |
That database is going to get really clogged.
Use periods instead of underscores. PHP Code:
|
Oh, I see a little better now. Your making an auction house dealy?
I follow the recommendation, use .'s instead of _'s I don't like how you have the string stored, but if I were forced to, I might search the categories like this. Untested, but i've done things like this in the past. PHP Code:
|
My logic is kind of shot on this, so i'll just ask. whats a better way to store this? Need to keep in mind that one account could have a ton of things in the auction house.
|
Quote:
|
Zodiac's Player Shops use a DB-NPC for all it's data storage, however we only store the item name and price, but if you plan on adding any specific search related features you'll definitely want to go with an SQL-based system to store you data in.
In your case though, you should be able to get away with DB-NPC basic flag storage without a hitch, SQL will most likely complicate things for you. |
Quote:
|
Quote:
PHP Code:
PHP Code:
|
I do understand that, I've done it before, just been about 8months since i touched gs2. If there is a better way, like I said, I'd love to learn. I just need explanations and examples. wiki doesnt seem to give too many answers on sql or this. If anyone feels like completely explaining an alternative that is better, I would love that. I really want to learn, not just be told.
|
PHP Code:
PHP Code:
PHP Code:
Its not doing anything :/ this.db is to the correct db name too. |
Try "DB_Auction.getCategoryListing(params[1]);" You can use dbnpc names directly. Also add an echo or 3 to the dbnpc script to make sure it's called, and your sending the right params and things.
Also, echo("List: " @ temp.listz) so it shows up even if the list is empty. And why are you calling the db function twice in a row? |
tried an echo for:
PHP Code:
PHP Code:
|
Try putting this flag:
item.Weapons.sssssssssss.Sword=sword2.png,0,0,0 |
it did everything but the last two 0's in the flag, so i changed it to 0,1,2
and it just echos "Sword,sword2.png,sssssssssss,2", |
Quote:
Different question, i have this script in the dbnpc as well. PHP Code:
Its not putting up values for the array of the flag in the dbnpc, what am i doing wrong now? |
Nevermind, got it. Was needing to set that . stuff up in the dbnpc, not in the wnpc. :)
|
| All times are GMT +2. The time now is 02:34 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.