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 .
ID:155422
![]() Jul 12 2011, 1:16 am
|
|
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... |
....
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 |
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) |
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 |
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
|
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
|
There wont be leading 0 dont wrry
And thx for help man It will be a big improvement for my poke game :D |
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
|
T.icon_state=num2text(src.Counter)