Log In  


Cart #37130 | 2017-02-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9


Cart #37095 | 2017-02-03 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

Cart #36936 | 2017-01-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

Cart #36248 | 2017-01-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

Cart #36194 | 2017-01-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

Hey, I've completed my textbox lib. It clocks in at a harsh 1600ish tokens, but you can cut away any escape sequences to lower that substantially. I've included a lite version that clocks in around 950 tokens. Let me know if you have any questions!

*1.0 Good enough for use.

*0.4 Bug fix update. Added a bunch of tests and ironed out lots of bugs. Token use is almost hitting 2k, so next updates will focus on lowering that.

*0.2 Almost a complete rewrite since version 0.1. It now uses a very efficient 2-pass system, but the token consumption is high, I will focus on lowering that once it's bug free.

9


I'd like to support ascii codes in strings. Does anybody know of a way of printing ascii codes in the form of an integer? eg:

code = 64
print(chr(code))

function chr(code)
--??
end

Just spitballing here, but I don't think Pico8 allows ASCII codes. It seems like a pixel font encoded inside pico8, so whatever OS sends to Pico8 would get translated into a hardcoded sprite. It might be best to ask zep.

Also, I know this is a 0.1 version of your library, but the code seems somewhat confusing to me (I am still a noob where it comes to coding). Is there a chance of you sharing a basic code, that would print text like it does now, at x,y with a length & height I could define (so basically inside a rectangle)?


Hey, thanks. I would prefer a more OOP approach, but since that can easily triple the token consumption, I've had to lay it all out. I posted a new version which shows some wrapped text. I'm going to spend some time optimizing it. I also need to figure out how to process long runs of text more quickly, as pico slows down.

The code is a bit messy, because a lot of code goes into wordwrapping and then trying to calculate escape sequences into that, which makes it really confusing. I'll try and document it a bit more. I did figure out a chr() function. I've posted it here:

chr function cart

function chr(ascii_code)
	ascii_table = "\00\01\02\03\04\05\06\07\08\09\10\11\12\13\14\15\16\17\18\19\20\21\22\23\24\25\26\27\28\29\30\31\32\33\34\35\36\37\38\39\40\41\42\43\44\45\46\47\48\49\50\51\52\53\54\55\56\57\58\59\60\61\62\63\64\65\66\67\68\69\70\71\72\73\74\75\76\77\78\79\80\81\82\83\84\85\86\87\88\89\90\91\92\93\94\95\96\97\98\99\100\101\102\103\104\105\106\107\108\109\110\111\112\113\114\115\116\117\118\119\120\121\122\123\124\125\126\127\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159"
	return sub(ascii_table, ascii_code+1,ascii_code+1)
end

Really neat. Had a go at my own textbox library a little while ago, not quite as many features but I tried to keep the token count as low as possible.
I especially like the color support.

Maybe you can add the token amount to the description?


Hey thanks, I'll be sure to add that on the next version. I took a look at your lib and might have to steal some features. I definitely need a pause escape sequence! Feel free to use the color idea if you like!



[Please log in to post a comment]