ID:273558
 
client
var
obj/hud/cursor/cursor
cursecanhorz=1
cursorx=2
cursory=9
North()
if(cursor)
if(cursory==9) return
cursory++
del(cursor)
cursor=new(src)
cursor.screen_loc="[cursorx],[cursory]"
else ..()
South()
if(cursor)
if(cursory==2) return
cursory--
del(cursor)
cursor=new(src)
cursor.screen_loc="[cursorx],[cursory]"
Center()
if(cursor)
world<<"HAHA "
West()
if(cursor && cursecanhorz)
if(cursorx<=2) return
else
cursorx-=5
del(cursor)
cursor=new(src)
cursor.screen_loc="[cursorx],[cursory]"
East()
if(cursor && cursecanhorz)
if(cursorx>=7) return
else
cursorx+=5
del(cursor)
cursor=new(src)
cursor.screen_loc="[cursorx],[cursory]"
Southeast()
var/obj/hud/border/
bordernorth=new(src)
bordersouth=new(src)
bordersouthwest=new(src)
bordersoutheast=new(src)
borderwest=new(src)
bordereast=new(src)
bordernorthwest=new(src)
bordernortheast=new(src)
cursor=new(src)
cursor.screen_loc="2,9"
bordernorth.dir=NORTH
bordersouth.dir=SOUTH
bordersouthwest.dir=SOUTHWEST
bordersoutheast.dir=SOUTHEAST
borderwest.dir=WEST
bordereast.dir=EAST
bordernorthwest.dir=NORTHWEST
bordernortheast.dir=NORTHEAST
bordernorth.screen_loc="3,9 to 8,9"
bordersouth.screen_loc="3,2 to 8,2"
bordersouthwest.screen_loc="2,2"
bordersoutheast.screen_loc="9,2"
borderwest.screen_loc="2,3 to 2,8"
bordereast.screen_loc="9,3 to 9,8"
bordernorthwest.screen_loc="2,9"
bordernortheast.screen_loc="9,9"
Northwest()
for(var/i in src.screen)
src.cursorx=initial(src.cursorx)
src.cursory=initial(src.cursory)
del(i)

It looks like a completely mangled mess and something tells me there's a better way of doing this...

Pressing Southeast brings up the menu, while North and South will move the cursor up and down until they hit the borders of the menu (which are the limits that I set), and West and East do a similar thing but they move it by a bigger amount (5 tiles).
For one, I recommend shifting the HUD system into a more sanitary object-oriented system. Handling the HUD under 'client' makes little sense to me. After you do that, you'd have an easier time organizing things by function and immediate purpose. Make sure you have a clean way to hook it up with your command interface. I imagine you'd need a 'menu' object and a 'cursor' object, the two separately handling these aspects of your HUD (the cursor object would, for example, contain all cursor related vars and handle drawing itself unto the menu; the menu will handle acrually drawing the menu and hooking its buttons's functions to its buttons). Perhaps an overarching 'HUD' object for generalised functions and handling communication between these two. [edit 2: on second thought, it might be better to have the 'cursor' object directly referred to by the menu object.]

Also, make sure you group together similar aspects of your code: I think the cursor movement function could be handled by one proc rather than spread out like that, for example (the opposite could also be advised: make sure to distance dissimilar aspects of your code, but this is not something for here).

I think the bulk of your displeasure is to do with the Southeast() verb, which opens the menu. If you don't want to manually type out the coordinates, consider using a .dmm file to lay out the menu like you would a map, then copying it to the player's screen. I'm pretty sure there is a demo for it under the 'Dantom' key somewhere (edit: here you go).

What else? I dislike how you delete and recreate the cursor all the time. Why not just redraw it to the screen?

Also note that "how can I improve this" and "a better way of doing this" are vague questions. Improve in what way? Better how? To get more concrete answers, you should first answer these questions.