Name Text

by Red Hall Dev
Display player/object names under their icon. [More]
To download this demo for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://RedHallDev.NameText##version=4

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://RedHallDev.NameText##version=4

120 downloads
Version 1
Date added: Jun 25 2015
Last updated: Aug 23 2015
1 fan
This demo will show a way to overlay text onto any player or object and centre it. To do this you can use a new type of object called Name_Text. It comes with 5 procs you can use.

/*
setText(text):
Set what text will be drawn

write():
Write the current set text on top of the object

clear():
Remove what was last written

setVerticalShift(number):
How many pixels up/down(positive/negative) you want to shift the text by.

setHorizontalShift(number):
How many pixels right/left(positive/negative) you want to shift the text by.
*/


From the demo:
mob
icon = 'Icons.dmi'
icon_state = "Player"

var
Name_Text/nameText

Login()
Move(locate(25,25,1))
nameText = new/Name_Text(src)
nameText.setVerticalShift(-11)
nameText.setText("Your name here")
nameText.write()
nameText.clear()

#IMPORTANT#

This is done using images. Images are naturally visible to no one. You MUST output images to each person in the game in order for other people to see them.

Like so:
                // Decide who sees the image
for(var/client/c)
c << nextImage


People may however join and leave a game meaning they weren't around when everyone was sent the image. Everyone will handle this a different way so I'm not going to include that as it would be a whole different demo altogether.

Jist of the message: If not everyone on your server can see a name then you're doing this wrong.