View Single Post
  #6  
Old 01-21-2014, 12:17 AM
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
Quote:
Originally Posted by fowlplay4 View Post
I mean using it for more than just tracking quest progress. You could have a stats table. I.e.

character_id
strength
dexterity
stamina
intelligence
exp
level

ID would be auto-generating.

Characters

1 toranksu
2 toranksu
3 fp4
4 (npcserver)
5 toranksu

To get character IDs you would do:

SELECT Character.id AS character_id
WHERE acct = player.account

Your character system would keep track of what character they're currently on using a flag like clientr.character_id and you would use that with your other tables rather than hardcoding account ids.

also my bad, it's escapestring2.

Alright, so my friend and I have a pretty solid foundation set up for the character slots and stuff, something we didn't initially intend on doing in the first place but are glad to have had the experience because it allows us to think and sort of script things we hadn't thought of having to compensate for multiple characters in the past...which leads me to my next question about something I might have overlooked earlier.

I think we will plan on having separate items (inventories, etc), between the characters linked to a specific player.

Ex: Character 1 might have, 2 apples, and one orange, and Character 2 might have 4 bananas and 3 grapes.

I had figured it would make better sense to store the inventory information in a table on sqlite, and link it to the character ID similar to how the others are being linked...

The problem I am having (and I haven't set this up yet), is determining if
A.) That is a viable option.
and
B.) If it is, what should I expect when a player ends up with 100 different items? {itemname, quantity} , etc? Would I just have

CharID | Items
Toran | {apple, 2}, {orange, 1}
Toran2 | {banana, 4}, {grape, 3}

and so on ? This seems sloppy to me, personally, but I suppose my alternative would be the same thing in clientr. flags ?

Also -- that brings me to my next point -- I could write a script to read all inventory items if I set the table up that way no problem -- but my concern is speed and effeciency? Should I load it ONCE, on the instance that the character is loaded, and then store it to clientr. flags, or should I just access that list whenever I need it? (equipping items, drawing the items needed to display in the inventory, etc...)...

Anyways, thanks for the help. I've personally never done anything like this before, and I was not familiar with SQLite until a few months ago. :P
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote