//dropping gold
obj/gold/var/amount = 0
obj/gold
icon = 'gold-bag.dmi'
mob
verb
drop_gold()
var/amount_to_drop = input(usr,"How much gold do you wish to drop?","Gold to Drop?",usr.gold) as num
amount_to_drop = round(amount_to_drop)
if(amount_to_drop > usr.gold)
usr << "You don't even have that much gold to drop."
return
if(amount_to_drop < 1)
usr << "You can not drop less than 1 gold."
return
else
var/obj/gold/bagofgold = new(usr.loc)
bagofgold.amount = amount_to_drop
usr.gold -= amount_to_drop
usr << "You drop [amount_to_drop] gold."
//getting gold
obj
verb
get()
set src in usr.loc
if(!amount_to_drop)
usr.Move(src)
usr.has_items += 1
usr << "You get [src.name]."
drop()
if(src.usage == "Equip")
usr << "This item is equip right now, remove it first"
return
if(src.usage == "None")
if(src.equip_types == "Weapon")
set src in usr.contents
src.loc = usr.loc
usr << "You drop [src.name]."
usr.has_items -= 1
if(src.equip_types == "Armor")
set src in usr.contents
src.loc = usr.loc
usr << "You drop [src.name]."
usr.has_items -= 1
obj
gold
get()
set src in usr.loc
usr.gold += amount_to_drop
usr << "You get [amount_to_drop] gold."
del(src)
Problem description:Ok now, I need to access the variable amount_to_drop from the drop_gold() verb in order to pick the (right amount of) gold up, but how. What the heck, this is pissing me off.
On the other hand, you can access the object's variable.