ID:833917
 
(See the best response by Forum_account.)
Code:
obj/HUD/LowCPU
layer=11
icon='TextGold.dmi'
mouse_opacity=0
var/OrigScreenLoc
var/OrigX;var/OrigPixX
var/OrigY;var/OrigPixY
New(hudx,hudxpix,hudy,hudypix,letter)
src.icon_state=letter
src.OrigX=hudx;src.OrigPixX=hudxpix
src.OrigY=hudy;src.OrigPixY=hudypix
src.screen_loc="[hudx]:[hudxpix],[hudy]:[hudypix]"
src.OrigScreenLoc=src.screen_loc
mob/proc/UpdateHUDText(var/ID,var/NewText)
var/client/C=src.client
if(C)
var/firstpos=0
NewText="[NewText]"
if(C.mob.LastTextIDs[ID]==NewText) return
C.mob.LastTextIDs[ID]=NewText
if(!(ID in C.mob.ObjectIDs)) {C.mob.ObjectIDs+=ID;C.mob.ObjectIDs[ID]=list()}
var/list/IdList=C.mob.ObjectIDs["[ID]"]
C.screen-=IdList
var/SlimOffset=0
while(C.mob)
firstpos+=1
var/letter=copytext(NewText,firstpos,firstpos+1)
if(!letter) return
if(firstpos>IdList.len) return
var/obj/HUD/LowCPU/O=IdList[firstpos]
if(O)
O.icon_state=letter
var/LowOffset=LowLetter(letter)*2
if(SlimOffset || LowOffset) O.screen_loc="[O.OrigX]:[O.OrigPixX-SlimOffset],[O.OrigY]:[O.OrigPixY-LowOffset]"
else O.screen_loc=O.OrigScreenLoc
if(SlimLetter(letter)) SlimOffset+=4
C.screen+=O
sleep(1)

mob/proc/WriteHUDText(var/hudx,var/hudxpix,var/hudy,var/hudypix,var/ID,var/NewText)
var/client/C=src.client
if(C)
var/firstpos=0
var/PixelSpace=6
NewText="[NewText]"
var/list/IdList=list()
src.LastTextIDs[ID]="/i"
if(!(ID in C.mob.ObjectIDs)) {C.mob.ObjectIDs+=ID;C.mob.ObjectIDs[ID]=list()}
for(var/obj/O in C.mob.ObjectIDs["[ID]"]) del O
while(C.mob)
firstpos+=1
var/letter=copytext(NewText,firstpos,firstpos+1)
if(!letter) {C.mob.ObjectIDs["[ID]"]=IdList;break}
var/obj/HUD/LowCPU/O=new(hudx,hudxpix,hudy,hudypix,letter)
C.screen+=O
IdList+=O
hudxpix+=PixelSpace
if(hudxpix>=32)
hudx+=1;hudxpix-=32


Problem description:For somereason it is only showing 9 letters no more then that.

Just use maptext.
In response to Kaiochao
Kaiochao wrote:
Just use maptext.

i would but it dosnt work and i just want it that with same outline.
In response to Lord Kakarot
Lord Kakarot wrote:
Kaiochao wrote:
Just use maptext.

i would but it dosnt work and i just want it that with same outline.

I have no idea what this is supposed to mean, but it looks like you said maptext doesn't work, which is not true.
I said I want to use icon as it is fully customizable with good outline, but can you atleast help me cause this only shows 9 letters on screen when name size is 15 letters
You can make a new font, too, which is fully customize-able, you know that right?

Also, since you don't know how to work it, would you mind telling me where you got this cluttered system?

Honestly, you would be better off using maptext. If you really want customize-able looks then you can create a new font. However, there are plenty of great fonts created for you already, which you can modify (and give an outline to) via HTML and CSS.
Then perhaps you can help me with outlining maptext
Is there a space in the name you're trying to display? One of the conditions to stop drawing in the text display is if(!letter) and a space would satisfy that check and cease drawing.

Also, to the other people in this thread, telling the OP to use maptext is lazy and doesn't actually help him to fix the actual issue he's having with posted code.
In response to tenkuu
tenkuu wrote:
Is there a space in the name you're trying to display? One of the conditions to stop drawing in the text display is if(!letter) and a space would satisfy that check and cease drawing.

Also, to the other people in this thread, telling the OP to use maptext is lazy and doesn't actually help him to fix the actual issue he's having with posted code.

I would prefer using MapText but i dont know how to add outline on that
Best response
You can create an outline around maptext by using multiple objects. Create four extra objects at a lower layer that have the same text shown in black. Offset each of those objects a pixel in each direction.
yea i seen how you have done in your Action RPG, but i was trying to find a simple method but anyways i got my problem solved.
i just rewrote the code which is based on datums and this is working fine.
mob/var/list/LowCpuHuds=list()

obj/HUD/LowCpuHud
icon='TextGold.dmi'
New(hudx,hudxpix,hudy,hudypix,letter)
src.icon_state=letter
src.screen_loc="[hudx]:[hudxpix],[hudy]:[hudypix]"

mob/proc/CreateHUDText(hudx,hudxpix,hudy,hudypix,VarID,WritAbt,NameTag,Text2Write)
if(src.client.eye!=src) return
if(!NameTag) NameTag=VarID
if(!WritAbt) WritAbt=src
new/datum/LowCpuHudDatum(src,VarID,hudx,hudxpix,hudy,hudypix,WritAbt,NameTag,Text2Write)

mob/proc/UpdateHUDText(var/ThisName,var/Text2Write,Animate=0)
for(var/datum/LowCpuHudDatum/D in src.LowCpuHuds) if(D.name==ThisName) {D.Refresh(Text2Write,Animate);return 1}

datum/LowCpuHudDatum
var/name;var/VarID
var/mob/WriteFor;var/mob/WriteAbout
var/x;var/xo;var/y;var/yo
var/list/ThisHud=list()
New(mob/Write4,NewVarID,hudx,hudxpix,hudy,hudypix,mob/WritAbt,NameTag,Text2Write)
src.WriteFor=Write4;src.VarID=NewVarID;src.name=NameTag
src.WriteAbout=WritAbt;WriteFor.LowCpuHuds+=src
src.x=hudx;src.y=hudy
src.xo=hudxpix;src.yo=hudypix
src.Refresh(Text2Write)
proc/Delete()
if(!WriteAbout || !WriteFor || !WriteFor.client) return
for(var/obj/HUD/LowCpuHud/O in src.ThisHud) WriteFor.client.screen-=O
del src
proc/Hide()
if(!WriteAbout || !WriteFor || !WriteFor.client) return
for(var/obj/HUD/LowCpuHud/O in src.ThisHud) O.icon_state="invis"
proc/Refresh(var/Text2Write,Animate=0)
if(!WriteAbout || !WriteFor || !WriteFor.client) return
if(WriteFor.client.eye!=WriteFor) return
if(!Text2Write) Text2Write=WriteAbout.vars["[VarID]"]
Text2Write="[Text2Write]"
//for(var/x in src.ThisHud) if(!x) src.ThisHud-=x //removes nulls o.O
if(src.ThisHud.len<length(Text2Write)) src.Create(Text2Write)
for(var/obj/HUD/LowCpuHud/O in src.ThisHud) O.icon_state="invis"
var/firstpos=0
while(WriteFor)
firstpos+=1
if(firstpos>src.ThisHud.len) return
var/letter=copytext(Text2Write,firstpos,firstpos+1)
if(!letter) return
var/obj/O=src.ThisHud[firstpos]
if(O)
if(!(O in WriteFor.client.screen)) WriteFor.client.screen+=O
O.icon_state=letter
if(Animate) sleep(1)
proc/Create(var/Text2Write)
if(!WriteAbout || !WriteFor || !WriteFor.client) return
var/firstpos=0;var/Icon2Use
for(var/obj/HUD/LowCpuHud/O in src.ThisHud)
src.ThisHud-=O;del O
var/hudx=x;var/hudxpix=xo;var/hudy=y;var/hudypix=yo
if(!Text2Write) Text2Write=WriteAbout.vars["[VarID]"]
Text2Write="[Text2Write]"
while(WriteFor)
firstpos+=1
var/letter=copytext(Text2Write,firstpos,firstpos+1)
if(!letter) return
var/LowerOffset=0 //offsets y,p,q,etc below baseline
if(LowLetter(letter)) LowerOffset=2
var/obj/HUD/LowCpuHud/O=new (hudx,hudxpix,hudy,hudypix-LowerOffset,letter)
if(SlimLetter(letter)) hudxpix-=4
if(Icon2Use) O.icon=Icon2Use
WriteFor.client.screen+=O;src.ThisHud+=O
var/hudxoff=7
hudxpix+=hudxoff
if(hudxpix>=32)
hudx+=1;hudxpix-=32