ID:149702
 
Okay, I am baffled, I get a undefined proc error:

obj/item
proc/DoUse()
verb
Use()
set src in usr
src.DoUse()

All it is is a Use() verb, that will be over-rid in soemthing like obj/item/cocacola, but does nothing by defualt. (In cases an item had no use!)
I'm not totally sure on this but it appears you're indenting src.DoUse() too far.
In response to Nadrew
Nadrew wrote:
I'm not totally sure on this but it appears you're indenting src.DoUse() too far.

Yes, DoUse() should be at the same indentation s set src... Also, I am still tring to figure out why people do src.proc or src.var when just using proc or var automatically defaults to src. IE:
src.DoUse()
can be simplified
DoUse()
In response to Ebonshadow
Ebonshadow wrote:
I am still tring to figure out why people do src.proc or src.var when just using proc or var automatically defaults to src. IE:
src.DoUse()
can be simplified
DoUse()


Because it's good to be in habit of using identifer tags in front of procs and vars because if you forget it in the wrong spot you won't know what you did wrong and be confused..
In response to Nadrew
Ebonshadow wrote:
I am still tring to figure out why people do src.proc or src.var when just using proc or var automatically defaults to src. IE:
src.DoUse()
can be simplified
DoUse()

There are also instances when var and src.var will be different values.

The only place I've ever used something like this is when intializing a new datum with several arguments (like in sd_Text). It's handy to be able to label arguments with the name of the variable it will be assigned to.

MyDatum
var
cheesiness = 0
New(some_arg, another_arg, cheesiness = 0, more_args_back_here)
..()
world << "My cheesiness is [src.cheesiness]"
world << "Setting my cheesiness to [cheesiness]"
src.cheesiness = cheesiness
// required to set the datum's cheesiness to the value in cheesiness
world << "My cheesiness is now [src.cheesiness]"

You can create a MyDatum with a specific cheesiness with just this command:
var/MyDatum/D = new(cheesiness = 52)