ID:144006
 
Code:
mob/var
list/Food = list()


obj/Item
var/tmp/Moved=0
Food
icon='Food.dmi'
Apple
icon_state="Apple"
Orange
icon_state="Orange"
Lemon
icon_state="Lemon"

DblClick()
if(!Moved)
Move(usr.Food)
Moved=1
else
Move(usr)
Moved=0


Problem description: For some reason it will not move into the list, Im not sure why. This is just an example of the code, the object will be on my screen when I DblClick it.

Dice1989 wrote:
mob/var
> list/Food = list()
>
>
> obj/Item
> var/tmp/Moved=0
> Food
> icon='Food.dmi'
> Apple
> icon_state="Apple"
> Orange
> icon_state="Orange"
> Lemon
> icon_state="Lemon"
>
> DblClick()
> if(!Moved)
> Move(usr.Food)
> Moved=1
> else
> Move(usr)
> Moved=0


Ok, the source of your problem is that a list can contain an object, but an object cannot be "in" a list. Objects can be moved into other atoms (turfs, mobs) but not into lists. What you really want to be doing is setting the objects location to null and adding it to the list. Also, there's no need for the Moved variable. Just check if the object is in the usr (Something like if(src.loc==usr) would be preferable).

Also, I suggest you look up Move() to fully understand what it's meant for.