proc
iqloohudu(var/mob/m)
var
list
int[2]
int[1] = num2text(m.nHealth)
if(!copytext(int[1],2,3))
int[2] = "0"
else
int[2] = copytext(int[1],1,2)
for(var/obj/hud/nhealthfirst/nhf in m.client.screen)
nhf.icon_state = int[2]
if(copytext(int[1],2,3) == "0" || !copytext(int[1],2,3))
int[2] = "0"
else
int[2] = copytext(int[1],2,3)
for(var/obj/hud/nhealthlast/nhl in m.client.screen)
nhl.icon_state = int[2]
world << nhl.icon_state
int[1] = num2text(m.nProtection)
if(!copytext(int[1],2,3))
int[2] = "0"
else
int[2] = copytext(int[1],1,2)
for(var/obj/hud/narmorfirst/naf in m.client.screen)
naf.icon_state = int[2]
if(copytext(int[1],2,3) == "0" || !copytext(int[1],2,3))
int[2] = "0"
else
int[2] = copytext(int[1],2,3)
for(var/obj/hud/narmorlast/nal in m.client.screen)
nal.icon_state = int[2]
iqloohudm(var/mob/m)
var/icon/i
for(var/obj/hud/nhealthlast/n in m.client.screen)
i = new(n.icon,n.icon_state)
i.Shift(EAST,18)
n.icon = i
for(var/obj/hud/narmorlast/n in m.client.screen)
i = new(n.icon,n.icon_state)
i.Shift(EAST,18)
n.icon = i
[EDIT]
What this code is tring to do:
Overall this is the initalization and the updating of a numeric based health/armor/ammo etc display - with healtn and armor being the only things implimented.
The lower proc, "iqloohudm()" is what initalizes the two number display by shifting the second number over, as to not take up a vast ammount of space on the hud display, or forcing me to make icons for every number 1-99.
The upper proc, "iqloohudu()" is what updates the two numbers each time the variable the coorespond to is changed. This proc does this by coverting said variable into text, then uses copytext() along with some yes or no statements to figure out what the first and second number of the variable are.
[/EDIT]
Problem description:
When I attempt to update the icon state of the second number it refuses to update.
A "world << " tells me that my proc is telling it the correct icon state to change itself to.
I am not too adept in how BYOND handles icons, so I am nearly 100% sure that the problem rests the shifting of the second number, which occurs in the bottom proc, and 80% sure it has something to do with making the icon new(), but I don't know of any alternate ways to do the second proc.
[EDIT]
Aside from being able to help me make this work - if you have any way of better doing this process, also feel free to post, and it would be much appreciated.
[/EDIT]
Thank you in advance.
Thats the most common approach