ID:139406
 
Code:
atom/proc/Display_Number(items/o,num)
if(num>999999)
num=999999
var/numlength=num2text(num,7)

var/image/num1
var/image/num2
var/image/num3
var/image/num4
var/image/num5
var/image/num6

if(length(string)>=0)
num1=image('Images/numbers.dmi',icon_state="[copytext(numlength,length(numlength),length(numlength)+1)]",pixel_x=-1,pixel_y=-12)
o.overlays+=num1
if(length(numlength)>=2)
num2=image('Images/numbers.dmi',icon_state="[copytext(numlength,(length(numlength)-1),(length(numlength)))]",pixel_x=-6,pixel_y=-12)
o.overlays+=num2
if(length(numlength)>=3)
num3=image('Images/numbers.dmi',icon_state="[copytext(numlength,(length(numlength)-2),(length(numlength)-1))]",pixel_x=-11,pixel_y=-12)
o.overlays+=num3
if(length(string)>=4)
num4=image('Images/numbers.dmi',icon_state="[copytext(numlength,(length(numlength)-3),(length(numlength)-2))]",pixel_x=-16,pixel_y=-12)
o.overlays+=num4
if(length(numlength)>=5)
num5=image('Images/numbers.dmi',icon_state="[copytext(numlength,(length(numlength)-4),(length(numlength)-3))]",pixel_x=-21)
o.overlays+=num5
if(length(numlength)>=6)
num6=image('Images/numbers.dmi',icon_state="[copytext(numlength,(length(numlength)-5),(length(numlength)-4))]",pixel_x=-26)
o.overlays+=num6
----

mob/proc/Update_Inventory()
var/no = 0
for(var/items/item in src)
Display_Number(item, item.amount) //send it to the item being looped and display its amount.
src << output(item, "viewchild_gridtwo:[++no]")

--extra clip to show my items that i want it to display to.. full clip of items.dm :D
items
parent_type = /obj

var
amount = 1

Equipment
var
colour = "#000000"
defense = 0
list/bonuses
eqslot
eqwear



TempClick
icon = 'NOICON.dmi'
bonuses = list()
Click()
if(src in usr.contents)
usr << "Clicked"


Display_Number(usr, 90)

// if(src.bonuses.len>0)
// usr << "G"
for(var/bonus in bonuses)
usr.vars[bonus] += bonuses[bonus]
else
src.Move(usr)


Problem description:
Ok so there shouldnt be anything wrong with getting this to display correctly. but for some reason whenever it goes to run it and output the numbers using the pixel_x's to align them it stacks them all up in one area (the first location and the default location of the numbers in the numbers.dmi)

Now ive even made it send to display on top of a player and it displays perfectly all the way upto the 999,999 which is the max that byond handles without doing that annoying 1+e006 bs.

so is it possible for anyone to explain why it works when outputting it to the player and aligns perfectly but when aligning to an object it fails to overlay properly.

~Midget
I moved the Display number proc onto just the basic click command when its not inside the user. and it outputs perfectly there to.

So anyone know whats going exactly.

Displays Perfectly when
~Outputting ontop of a player
~Outputting ontop of an item whens its NOT inside the player

Does not display when
~Inside a player.
In response to Midgetbuster
Could you show screenshot? Preferably two, one where it's right, and one where it's wrong.
In response to Ripiz


Uploaded with ImageShack.us

obviously the two that say 90 are correct and the one that says 9 is wrong. the 0 is there to but squished under
In response to Midgetbuster
It's BYOND limitation, it cannot display icons with offset in statpanel/grid. It would make icon bigger so it would have to make statpanel/grid bigger too.
It can be done but I guess staff doesn't want to add it (or maybe it's hard), it's not really needed either.
In response to Ripiz
Arr yea i thought it would be something like that.

Is there any way around this to be able to display an items amount as an overlay to an object inside a grid. as i want to use that instead of text numbers beside the name. =\
In response to Midgetbuster
You could try to make icon, containing numbers, to make smaller, exactly size of numbers, 3x6 or so. It MIGHT work then.
In response to Ripiz
XD that sentence is kind of confusing.

The icon part i understand sort of like i dunno making them all into one icon then overlaying the completed icon? but ensuring it doesnt extend the regions of the 32x32 pixel (which it doesnt even with 6 numbers)
In response to Midgetbuster
When your icon file is empty you can specify icon size in top right corner, default is 32x32 and cannot be changed after you add any icon_state inside.

But I have doubts it'll work.

There is one way that'll work for sure... Make different icon_state for every number.
In response to Ripiz
Orig: Hmm yea thats true. but that will produce a large .dmi file i guess =\ bugger such a pain indeed

After making new icon states for every position for each number. 6 digits, 9 numbers. 54 states later. +2 random states. the .dmi file size is still 1kb..

So yea. went with the mass icon states.

Thanks. And bugger stupid byond limitations :p