ID:165560
 
Ok so lets say i have this code:

var/sellable
var/sellprice
var/buyprice
obj
sword
icon = 'sword.dmi'
sellable = 1
sellprice = 190
shield
icon = 'shield.dmi'
sellable = 1
sellprice = 180
bag
icon = 'bag.dmi'
sellable = 1
sellprice = 300
shopkeeper
icon = 'shopkeeper.dmi'
icon_state = "normal_s"
obj/verb
shopkeeper
buy() // do i put anything in the parenthesis?
switch(input("Choose what you wish to buy","?")in list("Sword(200)","Shield(190)","bag(400)"))

How would i know what they picked there...and:
       sell()
switch(input("Choose what you wish to sell","Sell?") if usr.inventory=sword in list("Sword(200)"))

How would i get a variable to list every obj with sellable 1 in this list?

sorry about the bad coding, help me with variable setting aswell? Thanks, i just started coding and i need alot of help
bumpity
I like to use an item subtype for any inventory items. Then you can just loop through /objs of that type and add them to the list. The way you're currently doing it seems to me like it's going to cause problems (multiple item procedure like Get() or Drop(), or overriding such procs for /objs that aren't items).

obj/item
var/price

rubber_ball
price=2
super_sword_of_deathly_doom
price=42000

mob/verb/see_sellable_items()
var/list/sellable=new
for(var/obj/item/I in src)
sellable+=I // Fill the list.

for(var/obj/item/sellable_item in sellable)
src << "[sellable_item] will sell for [sellable_item.price]."