In the instance of scripting, say somewhere simple like SP Cost of a skill...
How would I go about /always/ have 3 digits?
ie:
Heal costs 4 sp.
In the skill window, I'd like it to say '004'.
Fire2 costs 25 sp.
In the skill window, it should say '025'.
Ultima costs 180 sp/
In the skill window, it should say '180'.
How would this be possible?
I have a feeling its a lot more complex than the idea itself :\
--J
You can use string-print-format instead of to_s.
You can look up printf formatting on google. The particular format that you need is %03d which means that there always are 3 digits and that leading zeros should be added in case there are less than 3 digits in the number. An example of usage would look like this:
self.contents.draw_text(x, y, w, h, sprintf('%03d', skill_id))
Ahha!
Ingenious.
I was unaware you could implant sprintf(asdfasdf) inside of draw_text.
Thank you kindly.
Yet again, Blizzard saves the day :P
--J