ID:1613742
 
(See the best response by Ter13.)
Code:
obj
verb
Equip()
if(!usr.InHand)
usr.InHand = src
usr.client.screen += src
else
usr.skalert("You have something equipped already.")



var/A = obj/Tools/Pickaxe

Click()
if(usr.InHand != A)
usr<<"No pickaxe"
return
if(usr.InHand == A)
usr<<"Pickaxe!"


Problem description:
Just wondering if I set lets say when Equip is called I set usr.InHand = src what is InHand actually being set to? I know it is not a path because when I debug everything and equip Pickaxe usr.InHand says it's set to Pickaxe. How can I do like in the Click(), if(usr.InHand == A) to see if what is stored in the InHand var is a Pickaxe?
Best response
It's set to a reference. All objects have an internal number that's their identifier. Object handles are just numbers that identify an object for its lifetime.
In response to Ter13
So there's no way to place the src that is in usr.InHand into another variable and then compare them to see if they are equal, because references are essentially item ID's correct?
In response to The WardenX
The WardenX wrote:
So there's no way to place the src that is in usr.InHand into another variable and then compare them to see if they are equal, because references are essentially item ID's correct?

Correct. You are talking about a deep compare. All that checking if two object references are equal does is check if the references point to the same object.

You'll have to write your own code for a deep comparison.
Okay Ter, thank you for your time. I will just take another route less time consuming.