ID:144980
 
Code:
                if("Sell")
usr.sell=1
usr<<"Click on the items you wish to sell"


mob/proc/Sell(var/obj/o as obj in src)
usr.Gold+=o.value
o.Move(src)
usr<<"<b>You sold the [o] for [o.value] gold</b>"
usr<<"<font color=green><b>[src]:</font></b> Thank you."
usr.sell=0
------------------------------------------------------------
obj/proc
Check()
if(usr.sell)
usr.Sell()
else
usr<<"Test"
------------------------------------------------------------
blah blah some random item
Click()
set src in usr.contents
src.Check()


Problem description:
When i click on the item after clicking on sell in the shop, i get a runtime error:

runtime error: Cannot read null.value
proc name: Sell (/mob/proc/Sell)
source file: NPCs.dm,50
usr: FriesOfDoom the King Dragon (/mob/player)
src: FriesOfDoom the King Dragon (/mob/player)
call stack:
FriesOfDoom the King Dragon (/mob/player): Sell(null)
Pickaxe (/obj/Pickaxe): Check()
Pickaxe (/obj/Pickaxe): Click("Inventory")

if i click on the item before i click to sell it, the "Test" goes to the usr like its supposed to. From the above i'm assuming that it can't read the obj's value, but im not sure. If thats so what do i need to change to make it work?
You're calling usr.Sell() in obj/proc/Check(). But mob/proc/Sell() requires an obj as an argument, so you really need to be calling usr.Sell(src) so that usr (the player) is trying to sell src (the object).

And second, "No put usr in proc. Ungh" -- Lummox JR
You should read this: Dream Tutor: usr Unfriendly
In response to Foomer
Foomer wrote:
You're calling usr.Sell() in obj/proc/Check(). But mob/proc/Sell() requires an obj as an argument, so you really need to be calling usr.Sell(src) so that usr (the player) is trying to sell src (the object).

And second, "No put usr in proc. Ungh" -- Lummox JR
You should read this: Dream Tutor: usr Unfriendly


lol, i know, during this thing i want to make sure though it would be seeing the usr. Thx you for your help