ID:144208
 
Code:
turf
grass
icon = 'grass.dmi'
DblClick()
set src in oview(1)
if(usr.shovel_equipped)
view() << "[usr] digs a path."
new/turf/path(src.loc)
else
usr << "You need a shovel equipped!"


Problem description:
When I compile it it's fine, but it gives me a runtime-error about a bad loc whenever I try it out. The code seems fine to me. What should I do?

You can't do it like that. You have to do it like:
var/turf/path/T = new(src.loc)


I would also suggest making the path an obj instead of a turf.
In response to Pyro_dragons
The only difference between what you suggested and what he suggested is that your creates a warning when you compile, about not using that variable. His way was fine in this case, and probably better.
In response to Audeuro
Ah right I forgot about that. Lemme patch that up.
var/turf/path/T = new()
T.loc = src.loc
In response to Pyro_dragons
Eh, knock it off. There's no reason to store a reference when unneeded and manually set the loc instead of just passing it as an arg to new(). This is just another one of those times you post without really knowing what you're talking about.
Yes, that will produce an error, since 'src.loc' is an area, so that loc doesn't quite specify where to put the new turf. Instead, use a turf loc. ie, the turf itself.
new/turf/path(src)


That will create a new /turf/path that will replace the 'src' turf. This also apparently causes all references to the old turf to automatically point to the new one, and as a side effect this won't actually stop the proc.
turf
Del() world<< "[src] DEL"
DblClick()
var/o_type = src.type
new /turf/water (src)
if(o_type != src.type) world<<"new turf"
water
icon_state="water"
New() world<<"NEW WATR"
DblClick()

This outputs "The turf DEL","NEW WATR" and "new turf" when you dblclick a turf.