This is my shop code. I'm totally lost when it comes to the sell part. Can anyone help?
turf
Shop
name = "counter"
icon = 'counter.dmi'
density = 1
Enter(mob/M)
switch(alert(M,"Welcome To the item shop what would you like to do?","Item Shop","Buy","Sell","Leave"))
if("Buy")
var/A = input("What would you like to Buy?","Buy")in list("Antidote Herb","Medical Herb")//choose to Deposit or Withdraw
if(A == "Medical Herb")//if you choose Deposit Gold
switch(alert(M,"Are you sure you want the Medical Herb?","Are you sure?","Yes","No"))
if("Yes")
if(M.gold >= 8)
new/obj/Medical_herb(M)
M.gold -= 8
M<<"Thanx come again!"
else
M<<"you dont have enough gold for that"
if("No")
M<<"come again!"
if(A == "Antidote Herb")
switch(alert(M,"Are you sure you want the Antidote Herb?","Are you sure?","Yes","No"))
if("Yes")
if(M.gold >= 10)
new/obj/Antidote_herb(M)
M.gold -= 10
else
M<<"you dont have enough gold for that"
if("No")
M<<"come again!"
if("Sell")
set src in oview(0)
var/list/sellcontents[] = new
for (O in M.contents)
sellcontents += O
sellcontents += "Cancel"
var/obj/sellchoice = input("What do you want to sell?") in sellcontents
if (sellchoice == "Cancel")
M << "Come again."
return 0
else
obj
var
cost
sell
Antidote_herb
icon = 'aherb.dmi'
name = "Antidote Herb"
cost = 10
sell = 7
Medical_herb
icon = 'mherb.dmi'
name = "Medical Herb"
cost = 8
sell = 5
-=ErdricktheGreat=-
ID:148911
Aug 19 2002, 8:08 am
|
|