• Need someone to make interactive clientside inventory interface.
    0 replies, posted
I've been working on a Developer's Resource of sorts for some while now, a very complex and customizable inventory addon. It's troublesome to go into detail, but one of the features is to allow custom clientside interfaces without the server's involvement (might make that optional). Because anyone is supposed to be able to make an interface, I think I should ask for a second opinion about how the client should work and how it and the server should interact. This is one of the reasons I'm asking for outside help, but also because I'm getting a bit tired of working on this and am inexperienced with interfaces. Some information -- Clients interact with the Server via console commands: [code] Pickup_Merge -- int ID, int Amount; Picks a certain amount from an item stack and stacks it with compatible items. Pickup_Give -- int ID, int Amount; Picks a certain amount from an item stack and puts it in its own stack. Drop -- int ID, int Amount; Drops a certain amount from an item stack. Stack -- int ID1, int ID2, int Amount; Stacks a certain amount from item stack #1 into item stack #2. Unstack -- int ID, Amount; Unstacks a certain amount from an item stack. Use -- int ID; "Uses" an item stack. Trade -- int Inventory[, int Trade] If second argument is nil, initiates trade with an inventory. If not, invites an inventory to an already-existing trade session. TradeShow -- int ID, int Trade Makes an item stack availible for other dealers to examine in a trade session. TradeIdenfity -- int ID, int Trade If the item stack is identified to the owner, "spreads" the identification state to the other dealers in that trade. TradeItem -- int Trade, int ID, int Inventory Sets an item stack to be given to a dealer upon completion of that trade session. TradeExpel -- int Trade, int Inventory Expels a dealer from a trade session. You can expel yourself to leave a trade session. TradeFinish -- int Trade Marks you as agreeing to finish a trade. When all dealers agree, the trade session is closed and the items are given to the dealers. Equip -- int ID, int Equipmode Equips an item using one of its equip modes (can't bother to explain here). Unequip -- int ID Unequips an item from its current equip mode. Load -- int ID1, int ID2, int Clip, int Amount Loads a certain amount from item stack #1 into one of item #2's clips. Unload -- int ID, int Clip, int Amount Unloads a certain amount from one of an item's clips. Reload -- int ID1, int ID2, int Clip, int Amount Unloads the whole clip from item #1, and then loads item #2 into that clip. AddFriend -- int Inventory Adds an inventory to your friend list. AddEnemy -- int Inventory Adds an inventory to your enemy list. AddNeutral -- int Inventory Removes an inventory from your friend/enemy list. ToggleFriend -- int Flag Toggles a flag for friend options (can't bother to explain). ToggleEnemy -- int Flag Same as above for enemies. ToggleNeutral -- int Flag Same as above for anyone not in either list. ShowItem -- int ID If flag is set in above options, allows friends/enemies/neutrals to see this item while it's in your inventory. GetSIDInfo -- int ID, str Information Requests information about an item (What can be requested is explained further below). GetIIDInfo -- int Inventory, str Information Requests information about an inventory (Same as above). [/code] Server interacts with the clients via usermessages and datastreams: [code] TInv_SIDEvent Identified Char: 1, Long: Stack ID, Bool: Identification State Amount changed Char: 2, Long: Stack ID, Float: New Amount Removed Char: 3, Long: Stack ID Equipped Char: 4, Long: Stack ID, Float: Inventory ID, Short: Equipmode Unequipped Char: 5, Long: Stack ID Details changed Char: 6, Long: Stack ID, Short: Detail (-1: Clip2, 0: Clip1, 1+: Durability Part), Float: New Value Added to Inventory Char: 7, Long: Stack ID, Float: Inventory ID Dropped Char: 8, Long: Stack ID, Float: Inventory ID Trading To Char: 9, Long: Stack ID, Float: Inventory ID, Short: Trade ID Removed from Trade Char: 10, Long: Stack ID, Short: Trade ID TInv_IIDEvent Requested Trade Char: 1, Long: Inventory ID Changed Friend Opts Char: 2, Long: Inventory ID, Short: Option Changed Enemy Opts Char: 3, Long: Inventory ID, Short: Option Changed Neutral Opts Char: 4, Long: Inventory ID, Short: Option Added Friend Char: 5, Long: Inventory ID, Float: Added Inventory ID Added Enemy Char: 6, Long: Inventory ID, Float: Added Inventory ID Added Neutral Char: 7, Long: Inventory ID, Float: Added Inventory ID Owner Char: 8, Long: Inventory ID, Entity: Entref Added stack to Trade Char: 9, Long: Inventory ID, Float: Stack ID, Short: Trade ID Joined Trade Char: 10, Long: Inventory ID, Short: Trade ID Expelled from Trade Char: 11, Long: Inventory ID, Short: Trade ID Finished Trade Char: 12, Long: Inventory ID, Short: Trade ID [/code] The above usermessages announce events about items or inventories that the player has permission to notice. This way, the player doesn't have to constantly request an items variables to see if they have changed. Note that events are only sent to players who are allowed to see them. The variables that are sent are ordered as shown above. Long and Short are always unsigned (except in TInv_SIDEvent "Details changed"). Therefore, weird things may start happening when: A) A Stack ID or Inventory ID is larger than 4,294,967,294, B) A Trade ID or Equip Mode is larger than 65,543, C) An item has more than 32,767 parts. However, those are some ridiculous limits and I doubt they'll be reached unless it's deliberate or a server runs for a very lengthy time. Also, those limits only apply to items that are viewable by clients. If they're completely invisible, there's nothing that might stop them. Two other usermessages are special: They don't announce events, instead they return information requested by the client through console commands. They only send answers to questions the client has asked; They don't say which question was answered. Because of this, clients have to "queue" info requests to know what was answered, and can't ask for 100 things at once, which would cause lagspikes. Particularly, if a client asks for things too fast to hog the server bandwidth, I might be able to code an (optional) auto-kick. Below is a list of information that can be requested, and how the usermessages with the answer will look. Usermessage "Inv_SIDInfo" -- [code] Long: Item ID Char: Errorcode; 0: No error. 1: Item with requested ID doesn't exist. 2: Variable didn't exist (nil or invisibly unidentified). 3: Variable is unavailible (NOT nil, but invisible or visibly unidentified). 4: Unable to identify variable type for sending via usermessage. Information "CID": Float: Item Class ID. Information "shortname": String: Short name of item. Information "longname": String: Long name of item. Information "shortdesc": String: Short description of item. Information "longdesc": String: Long description of item. Information "graphics": String: Sprite path, model path; It's only used for rendering clientside so it doesn't matter much. It's a string anyway. Information "category": Float: Category ID. Only used clientside to sort items into different categories. Information "value": Float: Relative value. Information "weight": Float: Weight. Information "size": Vector: Size. Information "stacksize": Float: Max stack size. Information "identifiable": Float: Identifiable bitmask (can't bother; Doesn't matter). Information "droppable": Float: Droppable bitmask. Information "invisible": Float: Invisible bitmask. Information "details": Float: Detail invisibility bitmask. Information "unique": Float: Unique values invisibility bitmask.
Sorry, you need to Log In to post a reply to this thread.