ID:1163861
 
(See the best response by Midgetbuster.)
Code:
image
Textarea
maptext_width = 128
maptext_height = 16

mob
var
image/Textarea/Textarea = new

client
MouseEntered(atom/o)
..()
if(src!=mob||istype(o, /mob/player)||istype(o, /mob/Enemies)||istype(o, /mob/npc))
for(var/image/Textarea/t in mob.client.images)del(t)
var/image/Textarea/t = image(mob.Textarea, o)
t.pixel_y=32
t.maptext = "<font size = 1>[o.name]"
mob.client.images+=t
MouseExited()
for(var/image/Textarea/t in mob.client.images)del(t)


Problem description: I'm trying get players to view other mobs' name when the mouse is on top of them if that makes sense. My first problem, is that I can't get the Textarea to delete once the mouse has left. Number two how can I center the name over the mob. Number 3, how can I stop it from showing the user's name meaning the one who is checking the names of over players not his.

Regards ^_^
Bump
Best response
Originally posted the solution to your problem but deleted it since i didnt know if you had viewed it or not..

Also tried doing this yesterday with no luck (admittedly i was trying to use dmifonts lib and wasnt watching tbh) but no response so gave it another go

here is a revised edition which is abit more code-friendly.

image
Textarea
maptext_width = 128
maptext_height = 16

mob
var
tmp/image/Textarea/nametag = new //we dont want to save this ideally

Login()
..()
nametag = image(nametag, src) //we want to create an easily accessible tag (may aswell use that mob var)
nametag.maptext = "<font size = 1>[src.name]"

client
MouseEntered(mob/o)
..()
if(!istype(o,/mob)) return
images += o.nametag //we just grab the entered mobs nametag and voola

MouseExited(mob/o)
if(!istype(o,/mob)) return
images -= o.nametag //and delete it.


may even be a better way to do this as im not sure how this would work online but yea.

Also fiddle around with the pixel y loc some more. but getting a precise centering may be hard cause you would need to grab the loc of your mouse or something else, gives you something to experiment with :P

Enjoy

EDIT: Prolly not a precise thing but i gave it a quick shot anyway using my name (Midgetbuster) -shrug-
place this under the nametag.maptext line
nametag.pixel_x = -lentext(src.name)
nametag.pixel_y = 32


~Midget
So I tried to implement what you bestowed upon me but unfortunately, it did not work. Have you tested this? or i'm I doing something wrong?

Regards my good man.
hmm.. odd it seemed to work fine for me, did you change anything? if so what changes did you make?
No changes just copy and paste. Umm would it help to know that my clients are mob/player?
Its working for him now, still havnt got the centering to work yet, if anyone has any insight as to how to do that we are both all ears :P

-Midget
You can use <center>text</center>. Make sure you set the maptext_width and pixel_x properly.