ID:1712348
 
(See the best response by Kaiochao.)
Code:
obj/item/deck

verb
Deck(var/obj/item/deck/A in usr.inventory)
set category = null
set src in usr

if(length(A.deck) == 0 && length(A.extra_deck) == 0)
usr << "Nothing is in this deck"
return

usr << "Main Deck"
for(var/obj/card/monster/B in A.deck)
usr << B.name
for(var/obj/card/spell/B in A.deck)
usr << B.name
for(var/obj/card/trap/B in A.deck)
usr << B.name

usr << "<br></br>Extra Deck"
for(var/B in A.extra_deck)
usr << B

Break_Deck(var/obj/item/deck/A in usr.inventory)
set category = null

for(var/obj/card/B in A.deck)
usr.trunk = usr.trunk + B
B.dir = NORTH
usr << "[B.name] added to trunk!"

del(A)


Problem description:
I want these two verbs to be accessed while in the inventory but the only way I can do it is when I set the location of the item to usr. Is there a way I can access it anyway without putting it in the usr.contents?
Best response
Is there any particular reason you can't use contents? The src setting for procs/verbs only supports certain settings.

If, for instance, you're displaying "everything in contents" inside a statpanel or something, then you should change those to display only the items you actually want to list.
Yeah true but I want to avoid and have two different lists for it. :/ (Duel Monsters Game, what are u gonna do). And even if I use contents everything still shows up. So is there a way I can limit something like:

verb(obj/item/deck/A)


but instead of everything under the /obj object tree, just only show what is under the /obj/item/deck tree while ignoring the others outside that path?
In response to DevDuelist
Well, I guess there's this:
// for whatever your player type is
mob/whatever

var
// some list of items, I'm guessing
inventory[0]

verb
// define the verb in your player, not in the items
// this verb asks for a certain type of object
// in a certain list of src
Deck(obj/item/deck/A in inventory)
if(!(A.deck.len || A.extra_deck.len))
src << "Nothing is in this deck."
return

// etc.
That wasn't it.

What I had to do was set it under /obj/deck/verb. And yeah it turns I have to do it under usr /sigh.

Oh well. Thanks for your help anyway :)