ID:155422
 
Well I am planning on adding a step counter for my poke game
Not sure how to code it so that the icons with states 0-9
representing each number will make real numbers like for example 923
Any ideas?
It will be on the hud of the player in the left upper corner
The number will be in a var, I just need to know how to make it shown by the numbers icons .
for(var/obj/HudCounter/T in src.client.screen)
T.icon_state=num2text(src.Counter)
In response to Pakistan
Yea but what if the number is 10 for example
I need to place the 1 in before the 0
In response to Kisuo
oh well you could have your icons be all in 32x32 is what i thought otherwise...

if(src.Counter==10)
for(var/obj/HudCounter/T in src.client.screen)
T.icon_state="1"
for(var/obj/HudCounter2/T in src.client.screen)
T.icon_state="zero"


but i would prolly then just use a skin with a output on it...
In response to Pakistan
....
I want the numbers to be equal the counter
So it will be 1-999
I just need a proc that will transform the number into an icon and place it in the right pixel_x
In response to Kisuo
sure!
make a skin (guessing your window is named default here)
put in a output box name it Counter

usr<<output("[usr.Counter]","default.Counter")

otherwise if your looking to do it with a hud i would check out:

http://www.byond.com/developer/SilkGames/SilkHUDsSilver

(not sure if your answer is there but its a start)
In response to Pakistan
I will try to use the skin
But if it wont allow me to use my own pic I will check out the hud thing
In response to Kisuo
some this like this should work. i could make into a counter if u required. Sorry its a bit messy and could have been done much better but this is a rough for you

mob/verb
numbergen(n as num)
if(isnum(n)) //used just to make sure its anumber
var/t = "[n]"
var/pixX = 0
for(var/i = 1,i <= length(t), i++)
var/a = copytext(t,i,i+1)
var/obj/numb = new()
numb.icon = 'numz.dmi'
numb.icon_state = "[a]"
numb.screen_loc = "1:[pixX],1"
usr.client.screen += numb
pixX += 32
In response to AbdulH
So this really makes a var go into a number on the hud?
In response to Kisuo
yeah shud try it. but instead of using my icon file use ur own. Oh yeah by the way it will appear at the bottom of the screen on the left like i said i was in a bit of a rush when i made this so it could have been better
In response to AbdulH
So I just need an icon with states 0-9?
In response to Kisuo
Yep, just 0-9 and it shud build it but i dont think 001 will appear i think it will appear as 1. It removes the leading zero's. its an easy fix its just im using the num type since i want to do an error check
In response to AbdulH
There wont be leading 0 dont wrry
And thx for help man
It will be a big improvement for my poke game :D
In response to Kisuo
No problem, glad i could be of help. if you require any more help someone will be glad to help out or just message me and i will try my best to aid you
I was making on a Pokewalker code
I have only make step counter
You can download it here