mob
NPC
shopkeeper
planet=""
icon = 'Shopkeeper.dmi'
Vegeta
icon_state="Vegeta"
layer=50
density=1
attackable=0
Namek
icon_state="Namek"
layer=50
density=1
attackable=0
Earth
icon_state="Earth"
layer=50
density=1
attackable=0
Icer
icon_state="Icer"
layer=50
density=1
attackable=0
Hell
icon_state="Hell"
layer=50
density=1
attackable=0
Heaven
icon_state="Heaven"
layer=50
density=1
attackable=0
DblClick()
Installshop()
var/player/P = usr
if(!P.frozen)
switch(input("Welcome to your local shopkeeper.") in list ("Buy","Sell","Cancel"))
if("Buy")
var/obj/Item/R = input("What would you like to buy?","Shopkeep",text)in contents
if(alert("Buy [R]? Cost: [R.cost] zenni","Yes","No")=="Yes")
if(R.cost>P.zenni)
P.zenni -= R.cost
new R(usr)
P<<"You bought [R]!"
else
P<<"You do not have enough zenni!"
if("Sell")
var/list/sellable = list()
for(var/obj/O in usr)
if(istype(O))
sellable += O
break
var/selling = input(sellable)
if(alert("I'll give you [O.cost * O.buyprice] for it. Deal?", "Yes", "No") == "Yes")
usr << "Thank you for your business!"
usr.zenni += O.cost * O.buyprice
del(selling)
Problem description:
After the input opens asking to Buy or Sell, I click Buy and I get an in-game error:
runtime error: Cannot read null.cost
proc name: DblClick (/mob/NPC/shopkeeper/DblClick)
source file: Shopkeeper.dm,48
usr: Lol (/player)
src: Vegeta (/mob/NPC/shopkeeper/Vegeta)
usr.loc: Desert Five (114,135,4) (/turf/newturfs/Desert_Five)
src.loc: the cliff23 (114,136,4) (/turf/cliff2/cliff23)
call stack:
Vegeta (/mob/NPC/shopkeeper/Vegeta): DblClick(the cliff23 (114,136,4) (/turf/cliff2/cliff23), "default.map", "icon-x=17;icon-y=10;left=1;scr...")
I Click Sell, nothing happens.
Any pointers?