Log In  

finaly found my way in 2 code line to display the sting of a 5 digits score:

sc="00000"..tostr(score)
sc=sub(sc,#sc-4,#sc)

Well perhaps you guys got something better? lol

time to update this to my pico games! 8-)

P#63478 2019-04-13 18:05 ( Edited 2019-04-14 03:27)

:: Xii

Hey, clever way of padding strings. Thanks for sharing!

P#63485 2019-04-14 01:20
1

looks like @lummi who made Missile Command as found some nice 6 digits score display..
nice ans simple! :)

sc=sub("00000",#tostr(score))..score
P#64124 2019-05-01 15:53 ( Edited 2019-05-01 15:55)
1

sub() accepts negative indices to count from the end, so you can do even a bit better than that:

sc=sub("0000"..score, -5)

You could also use 0xFFFB instead of -5 to save one more token.

P#64189 2019-05-05 17:50

@Saffith clever, simpler ans easy to remember. Thanks! :)

P#64196 2019-05-06 01:16

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-07-16 03:25 | 0.048s | 2097k | Q:22