ID:174129
 
I get no errors compiling, but get this in-game when I try to purchase something :
runtime error: cannot append to list
proc name: Buy (/mob/ClothesShop1/verb/Buy)
usr: Ease (/mob/characters/Human)
src: Dolores Basic Clothes Shop (/mob/ClothesShop1)
call stack:
Dolores Basic Clothes Shop (/mob/ClothesShop1): Buy()

If you need the code for my shop it is :

mob
ClothesShop1
name = "Dolores Basic Clothes Shop"
icon = 'Mobs.dmi'
icon_state = "ClothShop1"
verb
Buy()
set src in oview(1)
set category = "Communications"
switch(input("What would you like to buy (All shirts are 18 GP, all Trousers are 60GP)?")in list("Red Shirt","Blue Shirt","Green Shirt","White Shirt","Red Trousers","Blue Trousers","Cancel"))
if("Red Shirt")
if(usr.GP>=18)
usr.contents += /obj/Clothes/RedShirt
usr<<"You bought a Red Shirt!"
usr<<"You paid 18GP!"
usr.GP -= 18
else
usr<<"You don't have enough money!"


Thank you!

~Ease~

Everything is at ease with Ease
Ease wrote:
I get no errors compiling, but get this in-game when I try to purchase something :
runtime error: cannot append to list
proc name: Buy (/mob/ClothesShop1/verb/Buy)
usr: Ease (/mob/characters/Human)
src: Dolores Basic Clothes Shop (/mob/ClothesShop1)
call stack:
Dolores Basic Clothes Shop (/mob/ClothesShop1): Buy()

If you need the code for my shop it is :

> mob
> ClothesShop1
> name = "Dolores Basic Clothes Shop"
> icon = 'Mobs.dmi'
> icon_state = "ClothShop1"
> verb
> Buy()
> set src in oview(1)
> set category = "Communications"
> switch(input("What would you like to buy (All shirts are 18 GP, all Trousers are 60GP)?")in list("Red Shirt","Blue Shirt","Green Shirt","White Shirt","Red Trousers","Blue Trousers","Cancel"))
> if("Red Shirt")
> if(usr.GP>=18)
> <B>usr.contents += /obj/Clothes/RedShirt</B>
> usr<<"You bought a Red Shirt!"
> usr<<"You paid 18GP!"
> usr.GP -= 18
> else
> usr<<"You don't have enough money!"
>

Thank you!

~Ease~

<font size = -3>Everything is at ease with Ease</font>

The bold line. You're trying to add a parent_type right to the player's contents. You need 'new/obj/Clothes/RedShirt'.

~>Volte
In response to Volte
Ive also found that trying to add to usr.contents or any other .contents for that matter results in either enter() proc errors or list errors. I always just use usr instead of usr.contents and it works fine
A contents list only holds atoms, so you can't add a type path to it--which is what you're doing.

Instead, you need to create an object first. There's no need to add it to usr.contents, since you can just create it in usr to begin with:
new /obj/Clothes/RedShirt(usr)

Lummox JR