ID:728987
 
(See the best response by Robertbanks2.)
I have two statpanels, one that shows what's in my inventory and another that shows what's in a container on the ground. In my game all dropped items are placed in a chest on the ground so it makes sense.

What's happening is that I want to be able to right click on the items in that second panel and choose to put them in the user's inventory, my own version of picking up an item on the ground.

Think about that though, it's not in usr.contents so when I tried to write up the verb I couldn't do it normally like this:

Container
verb
Get()
set src in usr

Move(usr) // From the container to the usr.


Why you ask? It's because what I really need to say is :

Container
verb
Get()
var/Containers/C = usr.chest
set src in C

Move(usr) // From the container to the usr.


But.. Of course I can't do this, for so many reasons :

error: category: bad statement
error: Move: undefined proc
error: C: unsupported src setting
warning: C: variable defined but not used

Any idea what I can do? Thank you so muchhhh!
You're setting the container in C, not the object you want to pick up. Also, I'm guessing Container is a datum, which means Move() isn't defined for src, which is a Container.

Why does the Get() verb need to belong to the container and not the item? You're doing pretty much the exact same thing as someone picking things up off the ground, just from a chest instead.
I'm really confused, maybe you've misunderstood me.

I have this

Containers
parent_type = /obj


These are on the ground. When players move over a tile with a container on it, the contents of that container are displayed in a statpanel:

mob
var
chest

mob
Stat()

if(chest)

statpanel("[chest]")

var/Containers/Chests/C = chest
stat(C.contents)


This works fine in displaying the container's contents. What I need to do is set the get() verb up so people can right click on an item in that panel and get it.

You Wrote
You're doing pretty much the exact same thing as someone >picking things up off the ground, just from a chest instead.

That's exactly it. My items on the ground look larger than a player so I want them in a chest instead.
So give the item the Get() verb, not the chest, and limit it to being picked up by people who are accessing its container.

obj/item/verb/Get()
set src in usr.chest.contents
Move(usr)


Something along those lines should be what you're looking for.
In response to Robertbanks2
Items/verb/Get()

set src in usr.chest.contents
Move(usr)


error: usr.chest.contents: undefined var

That was my initial thought too, usr.chest equals the container on the ground so surely I thought I could point to it but the problem is that the function can't see I'm talking about an obj.
You could always just use if(loc==usr.chest) instead.
In response to Robertbanks2
You mean to not set any parameters? That would mean people would be given the option to get something that's already in their inventory. Sounds like you're confirming my thoughts, this is a flaw in the DM and not my own programming skill.

Would that be correct?
Best response
Not so much a flaw in the language as an issue with how you want to do things. Why do you even need the verb? Is there a reason for not being able to just set it to the object Click()/DblClick()?

I did a little playing around and clicking/dblclicking works just fine for this, and prevents people from having access to unnecessary verbs when they shouldn't, since there is no verb associated with it and you can just have the click/dblclick act contextually(if in chest, get, if in inventory, drop, etc.).

If you already have click/dblclick doing something else with items, there is also the right click, ctrl click(left and right), alt click(also left and right), etc.

So, again, is there some specific reason why it has to be a verb? It just seems like verbs aren't suited for this kind of thing.
In response to Robertbanks2
Well that's an interesting point, perhaps if I include the instructions above the items in that panel. A verb would just look really nice and create more unity in the interface.

I suppose in terms of Native Development, custom src settings are kind of more like extra frills but it would make interfacing with items a breeze instead of relying on alternatives.

I do understand that I'm not doing what everyone else does and so any problems I encounter are my own but since when has anyone gotten anywhere for trying to be like everyone else and avoid trouble?