mob
weapon
Short_sword
name="short sword"
isweapon=1
equipped=0
var/obj/weapon/SS
Long_sword
name="long sword"
isweapon=1
equipped=0
var/obj/weapon/LS
helm
Leather_helm
name="Leather Helm"
ishelm=1
helm=1
Iron_helm
name="Iron Helm"
ishelm=1
helm=1
chest
Leather_chest
name="Leather Helm"
ischest=1
chest2=1
Iron_chest
name="Iron Helm"
ischest=1
chest2=1
legs
Leather_leggings
name="Leather Leggings"
islegs=1
legs2=1
Iron_leggings
name="Iron Leggings"
islegs=1
legs2=1
gloves
Leather_gloves
name="Leather Gloves"
islegs=1
legs2=1
Iron_gloves
name="Iron Gloves"
isgloves=1
gloves2=1
boots
Leather_boots
name="Leather Boots"
isboots=1
boots2=1
Iron_boots
name="Iron Boots"
isboots=1
boots2=1
mob
verb
Shop()
src<<"You browse the items for sale."
src.shop = input("Which item would you like to buy?.","Buy",src.shop) in list("short_sword - 50","long_sword - 100","leather_helm - 50","iron_helm - 100","leather_chest - 50","iron_chest - 100","leather_leggings - 50","iron_leggings - 100","leather_gloves - 50","iron_gloves - 100","leather_boots - 50","iron_boots - 100","Cancel")
if(src.shop=="short_sword - 50" && src.gold>=50)
src.gold-=50
src.contents+=SS
src<<"You buy a Short Sword."
return
if(src.shop=="long_sword - 100" && src.gold>=100)
src.gold-=50
src.contents+=LS
src<<"You buy a Long Sword."
return
if(src.shop=="leather_helm - 50" && src.gold>=50)
src.gold-=50
src.contents+=LH
src<<"You buy a Leather Helmet."
return
if(src.shop=="iron_helm - 100" && src.gold>=100)
src.gold-=50
src.contents+=IH
src<<"You buy a Iron Helmet."
return
if(src.shop=="leather_chest - 50" && src.gold>=50)
src.gold-=50
src.contents+=LC
src<<"You buy a Leather Chest peice."
return
if(src.shop=="iron_chest - 100" && src.gold>=100)
src.gold-=100
src.contents+=IC
src<<"You buy a Iron Chest peice."
return
if(src.shop=="leather_leggings - 50" && src.gold>=50)
src.gold-=50
src.contents+=LL
src<<"You buy Leather leggings."
return
if(src.shop=="iron_leggings - 100" && src.gold>=100)
src.gold-=100
src.contents+=IL
src<<"You buy Iron leggings."
return
if(src.shop=="leather_gloves - 50" && src.gold>=50)
src.gold-=50
src.contents+=LG
src<<"You buy Leather gloves."
return
if(src.shop=="iron_gloves - 100" && src.gold>=100)
src.gold-=100
src.contents+=IG
src<<"You buy Iron gloves."
return
if(src.shop=="leather_boots - 50" && src.gold>=50)
src.gold-=50
src.contents+=LB
src<<"You buy Leather boots."
return
if(src.shop=="iron_boots - 100" && src.gold>=100)
src.gold-=100
src.contents+=IB
src<<"You buy Iron boots."
return
if(src.shop=="Cancel")
return
mob/var/short_sword=0
mob/var/long_sword=0
var/mob/weapon/SS = /mob/weapon/Short_sword
var/mob/weapon/LS = /mob/weapon/Long_sword
var/mob/helm/LH = /mob/helm/Leather_helm
var/mob/helm/IH = /mob/helm/Iron_helm
var/mob/chest/LC = /mob/chest/Leather_chest
var/mob/chest/IC = /mob/chest/Iron_chest
var/mob/legs/LL = /mob/legs/Leather_leggings
var/mob/legs/IL = /mob/legs/Iron_leggings
var/mob/gloves/LG = /mob/gloves/Leather_gloves
var/mob/gloves/IG = /mob/gloves/Iron_gloves
var/mob/boots/LB = /mob/boots/Leather_boots
var/mob/boots/IB = /mob/boots/Iron_boots
Problem description:You browse the items for sale.
runtime error: cannot append to list
proc name: Shop (/mob/verb/Shop)
usr: VolksBlade (/mob)
src: VolksBlade (/mob)
call stack:
VolksBlade (/mob): Shop()
when i try to buy something i have the money yet the error poped up.
However, your shopping system has many flaws. If you wanted to change the prices of a weapon, you would have to change the price in your shop code, change the text, and modify your conditions. A much easier and flexible way to do a shop system is to define a variable to the weapon, which is it's cost, and loop through a list of weapons that the players can buy. By using associative lists (having the weapon's name and price as the element, and the reference of the weapon as the association) you can easily make your shopping code much more flexible, dynamic, and robust.
I also see some potential flaws for your equipment system. Weapons shouldn't be mobs, as a starter, since they don't need to be controlled. (as in having a player move the weapon around) You have defined a variable for your weapon (equipped), which makes me think that you're relying on the weapon's variable to check if it's equipped. What you should be doing is defining a variable for your player that holds what weapon you have equipped. It is much safer and reliable to use this method instead of your own right now.