ID:270366
 
i know this is pretty newbish but how would i go about refranceing a var off a obj i was think along the lines of something like
mob/verb/shop()
var/list/ShopMenu = new()
for (var/O as anything in typesof(/obj/equipment))
GMShopMenu += O
GMShopMenu += "Cancel"
var/Choice = input("What item do you want?", "GM Shop", null) in ShopMenu
if (Choice == "Cancel")
return
usr.Gold-=Choice.SellValue
var/obj/Item = new Choice
Item.Move(usr)

this might be a little indented wrong i coded it in the form



National Guardsmen wrote:
i know this is pretty newbish but how would i go about refranceing a var off a obj i was think along the lines of something like
> mob/verb/shop()
> var/list/ShopMenu = new()
> for (var/O as anything in typesof(/obj/equipment))
> GMShopMenu += O
> GMShopMenu += "Cancel"
> var/Choice = input("What item do you want?", "GM Shop", null) in ShopMenu
> if (Choice == "Cancel")
> return
> usr.Gold-=Choice.SellValue
> var/obj/Item = new Choice
> Item.Move(usr)
>

this might be a little indented wrong i coded it in the form




Choice is a type, not an actual object. In order to do Choice.SellValue, you'll have to turn it into an item like you do a line below with var/obj/Items=new Choice. Just move the line usr.Gold-=Choice.SellValue down below var/obj/Item=new Choice and make it usr.Gold-=Item.SellValue and you should be set. And really you don't need the "as anything" in your for loop.
In response to Aaiko
Referencing*