ID:148015
 
I'm trying to have it put up to 10 character names on the hud, and it puts the letters up there just fine, but it seems that my pixel settings are having no effect, could anyone take a look?
obj/name
icon = 'Arial7pt.dmi'
screen_loc = "10,13"
layer = MOB_LAYER+10
pixel_y = -10
one pixel_x = 0
two pixel_x = 7
three pixel_x = 14
four pixel_x = 21
five pixel_x = 28
six pixel_x = 35
seven pixel_x = 42
eight pixel_x = 49
nine pixel_x = 56
ten pixel_x = 63

#define scs src.client.screen

mob/proc/add_name()
for(var/obj/name/one/O in scs)
var/T = copytext(src.name,1,2)
O.icon_state = "[T]"
for(var/obj/name/two/O in scs)
var/T = copytext(src.name,2,3)
O.icon_state = "[T]"
for(var/obj/name/three/O in scs)
var/T = copytext(src.name,3,4)
O.icon_state = "[T]"
for(var/obj/name/four/O in scs)
var/T = copytext(src.name,4,5)
O.icon_state = "[T]"
for(var/obj/name/five/O in scs)
var/T = copytext(src.name,5,6)
O.icon_state = "[T]"
for(var/obj/name/six/O in scs)
var/T = copytext(src.name,6,7)
O.icon_state = "[T]"
for(var/obj/name/seven/O in scs)
var/T = copytext(src.name,7,8)
O.icon_state = "[T]"
for(var/obj/name/eight/O in scs)
var/T = copytext(src.name,8,9)
O.icon_state = "[T]"
for(var/obj/name/nine/O in scs)
var/T = copytext(src.name,9,10)
O.icon_state = "[T]"
for(var/obj/name/ten/O in scs)
var/T = copytext(src.name,10,11)
O.icon_state = "[T]"
You need to set the screen_loc like this:

screen_loc = "[x_pos]:[x_pixel_off],[y_pos]:[y_pixel_off]"
pixel_x does not apply to screen objects. Instead, you set that as part of their screen_loc. screen_loc is formatted as: "[x]:[pixel_x],[y]:[pixel_y]". If that description isn't good enough, look up screen_loc in the DM help.
In response to OneFishDown
I gotcha, I didnt know that, thanks OFD.
In response to tenkuu
Thanks to you too, yours explained it a bit more than OFD's I just got to his first(and was able to comprehend it without further assistance).
I replaced that big ugly proc with this:
obj/name
icon = 'Arial7pt.dmi'
layer = MOB_LAYER+10
screen_loc = "10,13"

mob/proc/add_name_simple()
scs += new/obj/name/
for(var/obj/name/O in scs)
var/px = 0
var/py = -5
var/L = 0
var/Start = 1
var/End = 2
while(L <= 10)
var/obj/name/N = new()
var/CT = copytext(src.name,Start,End)
N.pixel_x = px
N.pixel_y = py
N.icon_state = "[CT]"
O.overlays += N
L++
px += 7
Start+=1
End+=1


It works just great, but is there anything I should have done differently?