mob
proc
UpdateInventory()
var/c = 0
var/r = 1
winset(usr,"inventory",{"cells="5x5""})
for(var/obj/O in src.inventory)
if(c==5)
r+=1
c=0
src << output(O,"inventory:[++c],[r]")
Problem description:
Hi everyone,
I've been using BYOND on and off since 2004 and have been programming a bit here and there making some fun little projects...
My latest project is one where you can control the users inventory onscreen easily for the user by clicking on the object and having a menu appear above it.
https://gyazo.com/da9c3465df99d4d0e935d0779fad8a3b
My problem is with the Grid inventory, I've scoured the forums and google as much as I can (like 7 hours over the last 2 days) trying to figure out a nice way to make it work.
I feel like the idiot I am... anyway, my issue is that the Grid control doesn't seem very flexible. Like if i wanted to have a background image behind the icons, or have a mouse over description on the inventory icons to show the obj's variables I haven't really found a way to do that.
Can anyone recommend a good tutorial or a way of handling inventory that is color/image customizable, and has alot of the features of inventory systems in modern rpg systems..
I've looked at hudgroups, and a bunch of other demos but can't seem to make heads or tails of it... (thus me feeling really dumb)
Anyway, if anyone is experienced in these things I wouldn't mind even paying for a couple hours of someone's time to teach me what I'm missing!
Thanks!!
For displaying mouse-over descriptions for your inventory, you have three different ways of going about it: DMF, html5, and client.screen. DMF is probably the worst option of the three.
See if you were going to stick to using DMF grids...
You can capture mouseEntered events in the grid, which is nice, but you can't have a tooltip that hovers over the grid itself without doing something super hacky.
The closest thing you can do is to make an item description pane adjacent to the grid and build the tooltip (label text and images and so forth) according to the mouseEntered and mouseExited events.
Example 1: In this example, the menus are grids, the item icon is a grid, and the text boxes are labels.
Example 2: In this example, the inventory on the bottom right is a grid.
Additionally, dynamic DMF stuff is usually very laggy. In the first example, the GUI can take over 0.1 seconds to update, and is very unresponsive.
So one of the other ways you can go about this, is to replicate Doohl's html5 work in Severed World. This approach is webclient-only, as I understand it. I'm not knowledgeable on how to pull this off, so Doohl would be the one to poke for help with this. Doohl did write some introductory writeups for interfacing HTML5 and the BYOND webclient, but it seems to be incomplete...
The last alternative is to just stick to using client.screen objects.
I realize this is the most traditional approach, but I like having dreamseeker compatibility, and despite being the most traditional, it can still be very good looking.
Example 3
Example 4
The downside here is, this still won't perform as well as an html5 GUI, and maptext bounds are still a bit funky to try to size, since you can't accurately compute the size of the rendered text.