ID:812946
 
(See the best response by DarkCampainger.)
Code:
mob
dragon
icon = 'man.dmi'

:corpse //add to corpse definition
var/dragon_meat = 9

item/corpse
icon = 'man.dmi'
verb
home()
usr << "[dragon_meat]"


Problem description:
this code is a modified example from chapter 6 of the guide. i am getting an undefined dargon_meat var. yet if i change :corpse to item/corpse then i will not get an error. why is the path operator not working?
I've never used those, nor have I ever seen anyone else use those operators. While I'm not for sure, it's possible they just fell out of the language at one point or another.

Edit:

I toyed around with that example and it just doesn't seem to work. dragon_meat is not defined within the scope of item/corpse. I'm also led to believe that the example was just that, an example and not something you should be using in practice:

For now, this is a facetious example:

obj/corpse
icon = 'corpse.dmi'

mob
dragon
icon = 'dragon.dmi'

:corpse //add to corpse definition
var/dragon_meat

In this example, a variable is added to /obj/corpse from inside the definition of mob/dragon. This would presumably then be used by the dragon code in some way. For example, when a dragon dies and produces a corpse, the dragon_meat could be set to 1. Another dragon coming across such a corpse might protect it against scavengers. There would be better ways of accomplishing the same thing, but the point is that we were able to put the definition of the variable near the only place in the code where it would be used--a nice way to organize things.
Best response
The guide's example appears to be wrong. As it explains:
The : operator searches for a child starting in the current node and then in all its children if necessary. It is for this reason that it is called the look-down path operator. At the beginning of a path, it causes the search to take place from the root.

So if the current node is /mob/dragon, the "look-down path" operator can only see types like /mob/dragon/royal_dragon/corpse, because they're further down the tree.

However, if you can get it to start at the beginning of a path instead of the current node, it will start from the root and naturally be able to find all types. But wait, we can do that!

At the beginning of a path, [the /] operator has the special effect of starting at the root (or top level) of the code. Normally, a path is relative to the position in the code where it is used.

So we can do this:
obj/item/corpse
icon = 'man.dmi'
verb
home()
usr << "[dragon_meat]"

mob
dragon
icon = 'man.dmi'

/:corpse //add to corpse definition
var/dragon_meat = 9


Also keep in mind that they are order-sensitive, unlike most of DM. So the definition of /obj/item/corpse has to be before you use the ':' operator.