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").
related? ID:706546