ID:170918
 
mob
verb
Test()
world << "[src.dir]"

That returns a number from 1-10 when clicked;What am I doing wrong?, I'm totally stumped.

Thanks in advance.
-Thorg
That's because dir is a number from 1 - 10. The directions are constants predefined by DM.

NORTH = 1
SOUTH = 2
EAST = 4
WEST = 8

Diagonals are the cardinal directions logically ORed together:

NORTHEAST = NORTH | EAST = 5
SOUTHEAST = SOUTH | EAST = 6
NORTHWEST = NORTH | WEST = 9
SOUTHWEST = SOUTH | WEST = 10
In response to Shadowdarke
Thanks, Did it allways work like that?, the F1 brought up help screen said it should output one of the directions in capitals.

-Thorg
In response to Thorg
Yes, it's been like that since long before I came to BYOND. I looked at the reference and it is a little misleading the way it's presented. Those are the values dir is limited to, but it doesn't explain that those are constants for numerical values as I explained above. Here are a couple procs that might help.

    sd_dir2text(dir as num)
/* accepts a direction and returns the lowercase text name of
the direction */

switch(dir)
if(NORTH) return "north"
if(SOUTH) return "south"
if(EAST) return "east"
if(WEST) return "west"
if(NORTHEAST) return "northeast"
if(SOUTHEAST) return "southeast"
if(NORTHWEST) return "northwest"
if(SOUTHWEST) return "southwest"

sd_dir2Text(dir as num)
/* accepts a direction and returns the Capitalized text name of
the direction */

switch(dir)
if(NORTH) return "North"
if(SOUTH) return "South"
if(EAST) return "East"
if(WEST) return "West"
if(NORTHEAST) return "Northeast"
if(SOUTHEAST) return "Southeast"
if(NORTHWEST) return "Northwest"
if(SOUTHWEST) return "Southwest"