ID:158846
 
I've been searching for a while and cannot find an answer so here I go:

I'm trying to make a Grid, that has objects inside of it that are clickable.

For example:

Object 1 icon: Description
Object 2 icon: Descirption
etc.

The icon is supposed to be a representation of an action, like attacking or Searching, etc. and when you click it, the corresponding action is performed.

I've created objects,
obj
player
attack
var/mob/player/owner
basic
name = "Basic Attack"
icon = 'skillboxes.dmi'
icon_state = "basic"
Click()
owner.attack()


For example this one above. The idea is that it gets added to a player list (var/obj/player/attack/list/attacks, for example), it creates a new version of the object above, adds it to the player.attacks (Obviously setting the owner to the player), and when clicked in the grid, the action is performed.

Everything works fine, except I cannot get it in the Grid. I can get an image in the grid, but then it's not clickable, or I can get just the name "Basic Attack" in the grid, but I want both. I want "[icon] Basic Attack" in the grid, so that the player clicks the icon, and performs the action.

Is there any way to do this? I've been trying for a while, it's not working...I can't get the actual object to appear in the grid...that's basically what I want. I want the grid to house the object, so that you can click it and do whatever.
Bump >> Wondering if anyone can assist in this...I'm horribly lacking in knowledge of Interface stuff.
Your issue here is that you're probably adding the action objs to a seperate list. Try adding the objs to the usr's contents, that's usually the problem.
In response to Duelmaster409
It's required that they are in player.contents to show as an icon in the Grid? Why is that? (To be blunt: That sounds really stupid)
In response to Duelmaster409
Now I gotta ask: How do I put a text after it?

Code:
mob
player
proc
UpdateAttacks()
var/items=0
for(var/obj/player/a in src.contents)
winset(src, "attacks", "current-cell=[++items]")
src << output(a, "attacks")
winset(src, "attacks", "cells=[items]")


If there is ANY String attached to the first portion of output(a,"attacks") it instantly removes the icon. I can't find a way to get the icon to appear with some text after, without setting it into another cell (Which is a bad idea, honestly...should be obvious why)

Is there ANY WAY to get the Icon there, AND the Text, in the SAME cell?
In response to Polantaris
Probably not!

Also:
It's required that they are in player.contents to show as an icon in the Grid?

No, it's just required that the object in question continues to exist (and isn't garbage collected).
In response to Polantaris
Polantaris wrote:
Bump >> Wondering if anyone can assist in this...I'm horribly lacking in knowledge of Interface stuff.

That's why the Dream Maker Guild's Tutorial Section exists
In response to Kaioken
Kaioken wrote:
Probably not!

Also:
It's required that they are in player.contents to show as an icon in the Grid?

No, it's just required that the object in question continues to exist (and isn't garbage collected).

So how does one display an effective Inventory, or anything for that matter, inside a Grid? Seems impossible to me. I don't know about you, but when I look at an Inventory, I want to see the name, and an image (if there is one) for everything in my Inventory. Seems like this can't be done in a Grid.

So far the only thing I can see a Grid being used for is Stats.
In response to Mista-mage123
And where do you think I learned how to use anything in the Interface at all? I didn't just do a million trials and errors, I read up on it, but seemingly the second I want to do something away from what's documented, everything goes haywire, it seems to me that these interface things are way too picky, and must be used exactly a specific way, and once I try to do something away from it, well that's just not allowed. This is a perfect example.
In response to Polantaris
You use different cells. Duh. What's the problem in that? You can have the text right next to the icon (there is a 1-pixel irremovable border between cells, but it's suitable here), just in a different cell. Even statpanels essentially use different cells.
In response to Kaioken
There's at least two problems with that, and these are the most minimal
1) If I use the list as flexible, this obviously occurs: If the player has an issue where the grid is small on their screen (because of the resolution), then the icon can appear on a top cell (lets say 1,3) and the description will appear on (2,1) for them.
2) If I turn off flexible, then you have the problem where you have gigantic horizontal scrollbars that are ugly, and horrible to navigate when you need to use it quick. I'm using this as a skill system, to have your skills readibly available to be used. You find the skill, click it and use it. If you have to navigate through a stupid horizontal scrollbar AS WELL as a Vertical one, then it will cause a ton of problems. If I keep everything on 2 rows, then the list will easily get huge and make the vertical one hard to navigate as well.

Now, on the other hand if I could have both things in the same cell, the vertical scrollbar would only get large if the screen is really small, and as such you can keep it more organized, easier to handle, and easier to deal with. I don't understand why this is impossible in the first place. Weren't Grids created to do this type of thing? And it wasn't thought that people would want to do exactly what I'm doing, right now? I find that hard to believe.

Edit: Regardless, seems I'll have to do what I'll have to do.