ID:1393390
 
BYOND Version:500.1212
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 30.0.1599.69
Applies to:Dream Daemon, Dream Maker
Status: Deferred

This issue may be low priority or very difficult to fix, and has been put on the back burner for the time being.
I have some code in a project that works as follows:
var
const
ButtonEast = "beast"
ButtonWest = "bwest"
ButtonNorth = "bnorth"
ButtonSouth = "bsouth"
ButtonUse = "buse"
ButtonInteract = "bint"
ButtonMenu = "bmenu"

/datum/Configuration
var/list/CommandKeys = list( "bnorth" = "W", ButtonSouth = "S", ButtonWest = "A", ButtonEast = "D", ButtonUse = "Space", ButtonInteract = "E", ButtonMenu = "Escape" )


/mob/Soldier/FastTick()
..()
stunned = max(stunned-2,0)
if (client && !client.KeyboardHandler && client.EnableKeyboardMovement && !Config.InputSuspended)
world.log << Config.CommandKeys[ButtonSouth]
world.log << Config.CommandKeys[ButtonNorth]
world.log << Config.CommandKeys.len
if (client.Keys[Config.CommandKeys[ButtonSouth]] || client.Keys["South"])
step(src, SOUTH, MoveSpeed())
if (client.Keys[Config.CommandKeys[ButtonEast]] || client.Keys["East"])
step(src, EAST, MoveSpeed())
if (client.Keys[Config.CommandKeys[ButtonWest]] || client.Keys["West"])
step(src, WEST, MoveSpeed())
if (client.Keys[Config.CommandKeys[ButtonNorth]] || client.Keys["North"])
step(src, NORTH, MoveSpeed())


When I run this code, only the north-movement button works, where I substituted "bnorth" for ButtonNorth in CommandKeys. For some reason, although I use the same constant in the CommandKeys definition and when reading from it, the list associations are not properly set unless I use a raw string. I'm not sure if this is a compile error or a runtime error, but it does defy the expected behaviour. Using a var set to ButtonNorth, for example, also works (CommandKeys[ButtonNorthVar] = "W").
I recalled a similar bug report...
related? ID:706546
This doesn't change much, but in CommandKeys list you have "ButtonSourth".
A workaround could be to use text macros if it becomes a problem. I use constants in associative lists, but not in the manner you are using.
ButtonSourth was a typo after copying over to here; thanks for pointing it out.
Stephen001 changed status to 'Deferred'