ID:269973
 
i already set the values to some of my equipment. However, when i try to set them, i get errors. saying the var is undefined. i have obj set to dif types, like weapon and armor. meaning it is obj/item/weapon yadda yadda yadda. how can i add what they are worth to the verb?

Sell_Stuff()
switch(input("Would you like to sell something?","Sell Item") in list ("Yes","No"))
if("Yes")
set src in oview(1)
var/a = input("What item to do want to sell?","Type in name of item") as null
var/b = input("[a] is worth 0 gold. Do you still want to sell it?","Are you sure?") in list("Yes","No")
if(b == "Yes")
for(var/obj/O in usr.contents)
if(O.name == a)
del(O)
if("No")
return

obj/item/armor
Legendary_Dragon_Armor_Darigaaz
icon= 'Armor.dmi'
icon_state = "Legendary Dragon Armor - Darigaaz"
Defense = 1 //not perma
Resist = 1 //not perma
Required_Alignment = "Fire"
Value = 65000
Well that has goto be the crapiest selling code that ive ever seen. Here, use this:

Sell_Stuff()
switch(input("Would you like to sell something?","Sell Item") in list ("Yes","No"))
if("Yes")
set src in oview(1)
var/a = input("What item to do want to sell?","Type in name of item") as null|text in usr.contents
var/b = input("[a] is worth [Value] gold. Do you still want to sell it?","Are you sure?") in list("Yes","No")
if(b == "Yes")
usr.gold-=a.Value
del(a)
if("No")
return

obj/item/armor
Legendary_Dragon_Armor_Darigaaz
icon= 'Armor.dmi'
icon_state = "Legendary Dragon Armor - Darigaaz"
Defense = 1 //not perma
Resist = 1 //not perma
Required_Alignment = "Fire"
Value = 65000


I hope you know how to fix up any indentation errors(whenever I tab it selects post so I have to use space).

ADT_CLONE
In response to ADT_CLONE
That won't work. Var isn't difined, it's difined as an obj/var, thats why the for() statement is used.
In response to ADT_CLONE
No. Urgh

Okay, let's list the problems;
switch(input("Would you like to sell something?","Sell Item") in list ("Yes","No"))

It shouldn't ask if they want to sell something. They used the verb, intentionally or not, and that is going to just get in the way. If you wanted to keep that, you should make it an if(alert()=="Yes) type thing.

if("Yes") set src in oview(1)

Does that serve ANY purpose there? At all?

var/a = input("What item to do want to sell?","Type in name of item") as null|text in usr.contents

As TEXT? Are you crazy? as null|anything would be more fitting. Even so, you'd still need to check if(a) to make sure they don't cancel out and then get asked if they want to sell null.

var/b = input("[a] is worth [Value] gold. Do you still want to sell it?","Are you sure?") in list("Yes","No")

Again, this should be an if(alert()=="Yes") thing.

usr.gold-=a.Value
del(a)

Why delete it? Just move the object to the shopkeeper's contents, it makes for a more efficiently designed shopping system.