ID:160157
 
Applicable Configuration:
BYOND Version: 429.999
Operating System:
Web Browser:
Game/Hub(s): hub://
Video Card (for graphics bugs):

Descriptive Problem Summary:The get_dir() proc, atom.dir, etc are returning the numerical value of the direction so 1,4,8,2 for north east west south instead of NORTH EAST WEST SOUTH. Not sure if its suppose to or not but realized when i was doing a direction check and wasnt registering with the words so did a test to see what it was returning.

Numbered Steps to Reproduce Problem:make a simple verb like
mob/verb/Test()
usr<<"[usr.dir]"


Expected Results:Expected words like NORTH SOUTH according to the DM Guide

Actual Results:numbers 1-8 depending on direction

Does the problem occur:
Every time? Or how often?every time

Workarounds:Check for numbers instead of words just bringing this up not sure if it was changed and I couldnt find the post but i looked for a post about it and nothing came up.

You have to write your own proc for deciding the Directions in stead of numbers.
There's no other way to do it as of yet, I guess.
Some people perfer the numbers, I guess.
mob/verb/test()
src << "[direction(usr.dir)]"
proc/Direction(A) switch(A)
if(1) return "North"
if(2) return "South"
if(4) return "East"
if(5) return "Northeast"
if(6) return "Southeast"
if(8) return "West"
if(9) return "Northwest"
if(10) return "Southwest"

Should work I guess...?
NightJumper88 wrote:
Descriptive Problem Summary:The get_dir() proc, atom.dir, etc are returning the numerical value of the direction so 1,4,8,2 for north east west south instead of NORTH EAST WEST SOUTH. Not sure if its suppose to or not but realized when i was doing a direction check and wasnt registering with the words so did a test to see what it was returning.

Numbered Steps to Reproduce Problem:make a simple verb like
> mob/verb/Test()
> usr<<"[usr.dir]"
>
>


The upper-case names for directions are not text strings, they are defined constants whose values are set to the integers that comprise the direction system. NORTH is not "north", but is actually equal to 1:

mob/verb/check()
if(usr.dir == NORTH) usr << "you are facing north, represented by the integer [NORTH]."


As Super Saiyan X has suggested, you must take matters into your own hands to write a proc that will give you a string containing the text equivalent of a direction integer, such as "north" when given 1.
In response to Super Saiyan X
I wouldn't get in the habit of writing out numbers (or any other type of data) when you have defined constants.
if (NORTH) return "North"
In response to ACWraith
I would use a list.

var/list
Directions = list("North","South",,"East","Northeast","Southeast",,"West","Northwest","Southwest")

mob
verb
Test()
usr << Directions[usr.dir]