ID:139182
 
Code:
mob/NPC
Tutorial_Helper
var/r;var/g;var/b;var/mod=0.5
name="Tutorial Helper";NPC=1
New()
CreateName()
var/Body=rand(1,2)
if(Body==1) usr.icon='BaseWhite.dmi'
if(Body==2) usr.icon='BaseBrown.dmi'
r=rand(0,255);g=rand(0,255);b=rand(0,255);usr.HR=round(src.r*mod);usr.HB=round(src.b*mod);usr.HG=round(src.g*mod);src.HairStyle=rand(1,3);src.Load_Overlays()


Problem description:
I didn't know what to post for the "Code:", so I just posted that . But anyways, no matter what I do I can't get the text for the NPC to show up. I'm using LummoxJr's DMIFont's library .
I think you are misunderstanding what usr is. You should look it up in the reference. What you really want here is src, which is the "source" object.

Also:

Lummox JR wrote:
No put usr in proc. Ungh.
In response to DarkCampainger (#1)
Even if I use src, it won't work :/
In response to Flysbad (#2)
Flysbad wrote:
Even if I use src, it won't work :/

What does your Load_Overlays() process do? Is there any chance it's removing the name overlay?
In response to DarkCampainger (#3)
I removed Load_Overlays, and It still didn't work . Load_Overlays just loads the users overlays basicly .
You should post the CreateName() proc where the text is being created. Since you're also loading the overlays, I wonder if you're clearing the overlays list after creating the name, which would explain the text not showing up; in that case moving CreateName() to the end of this routine would be the way to go.

Lummox JR
In response to Lummox JR (#5)
proc/QuickName(atom/A, txt, color="#fff", outline, top, size=3, layer=MOB_LAYER+200)
if(outline && !istext(outline)) outline = "#000"
txt = GetLines(KeyToBreakable(txt), width=size*32, maxlines=round(32/height), flags=DF_WRAP_ELLIPSIS)
var/iconset/s = DrawText(txt, x=size*16, y=(top?(32-height-(outline?1:0)):(outline?1:0)), width=size*32,\
flags=(DF_JUSTIFY_CENTER|DF_NO_FORMAT), icons_x=size, icons_y=1)
if(color!="#fff") s.Blend(color,ICON_MULTIPLY)
s.Transparent(0)
if(outline)
var/iconset/s2 = DrawText(txt, x=size*16, y=(top?(32-height-(outline?1:0)):(outline?1:0)), width=size*32,\
flags=(DF_JUSTIFY_CENTER|DF_NO_FORMAT), icons_x=size, icons_y=1)
s2.Dilate()
s2.Transparent(0)
s2.Blend(outline,ICON_MULTIPLY)
s.BlendSet(s2,0,0,ICON_UNDERLAY)
var/obj/O = new
O.layer = layer
O.pixel_y = top ? 32 : -32
O.pixel_x = (1-s.w)*16
for(var/i=0, i<s.w, ++i)
O.icon = s.GetIcon(i,0)
if(!O.icon) continue
A.overlays += O
O.pixel_x += 32

CreateName(r=255, g=r, b=r)
var/outline = "#fff"
if(30*r+59*g+11*b > 7650) outline = "#000"
namefont.QuickName(src, key, rgb(r,g,b), outline)