var
dirs = list(NORTH=1, NORTHEAST=2, EAST=3, SOUTHEAST=4, SOUTH=5, SOUTHWEST=6, WEST=7, NORTHWEST=8)
client
New()
mob = new/mob/police
East()
dir = dirs[dir] + 1
if(dir > 8)
dir = 1
West()
dir = dirs[dir] - 1
if(dir < 1)
dir = 8
Problem description:
When I try East() and West(), all I get is a runtime error saying that it tried to add/subtract 1 from "NORTH", even though I've already associated a number with it.
Thanks.
- Gamermania.
The reason your code isn't working is either because list(NORTH=1, ...) is probably being read as list("NORTH" = 1), meaning NORTH is a string, while directions that BYOND uses aren't actually strings.
And, lists can't associate numbers with anything. If you try to associate a number with a value, you'll just end up setting that index to the value (and probably getting an index out of range error).