ID:263410
 
Code:
mob
verb
PlayCard(obj/Cards/C in usr.trunk)
if(istype(C,/obj/Cards/))
C = new /obj/Cards/Test(locate(usr.x-2,usr.y+1,usr.z))
trunk.Remove(C)


Problem description:

The card doesn't get removed from the list Trunk when played.
Dead_Demon wrote:
Code:
> mob
> verb
> PlayCard(obj/Cards/C in usr.trunk)
> if(istype(C,/obj/Cards/))
> C = new /obj/Cards/Test(locate(usr.x-2,usr.y+1,usr.z))
> trunk.Remove(C)
>

Problem description:

The card doesn't get removed from the list Trunk when played.

How could it be? You only just created the card; it's not in the list.

Lummox JR
In response to Lummox JR
obj
icon='items.dmi'
Cards
verb
Grab(mob/M)
set src in oview(1)
if(istype(M,/mob/))
M.trunk.Add(src)


The card gets added to the list when you pick it up. I just can't get it to leave when I play it.
In response to Lummox JR
Lummox JR wrote:
Dead_Demon wrote:
Code:
> > mob
> > verb
> > PlayCard(var/obj/Cards/C in usr.trunk)
> > if(istype(C,/obj/Cards/))
> > new /obj/Cards/Test(locate(usr.x-2,usr.y+1,usr.z))
> > usr.trunk-=C
> >

Problem description:

The card doesn't get removed from the list Trunk when played.

How could it be? You only just created the card; it's not in the list.

Lummox JR


The problem is you're redifining C right after verifying it's a card. So instead of removing the initial C you defined in the PlayCard verb, you're trying to delete the brand new C you just created. Just dropping the "C =" like so should work. Also, I changed it to my preferred method of list removal.