Log In  



Just another mad coder.

We're all mad. I'm mad. You're mad, you must be - or you wouldn't have come here.


Could someone help me with this please ? I'm trying to understand how this works.


for i in all(var) do
  print(i.." "..var)

And yes, I know I can use:


But I want to be able to iterate each item per line and in any order, and the ability to remove them as well.


And to recall a value: print(var."playhp") returns 500. And ability to recall a value be reference:

print([email protected]) also to return 500.

And print(#var) to return 4, currently returns 0 (zero).

Thanks in advance !

P#68005 2019-09-22 21:28 ( Edited 2019-09-22 23:01)

Cart [#yield_fireball-0#] | Code | 2019-09-22 | License: CC4-BY-NC-SA | Embed

You ever have that moment when somebody tells you something and you SORT OF get it but not really, and then later, maybe a day or two you cry out, "Ah ha !" because then you understand it ?

Well I'm not going to claim full knowledge of the YIELD() command, but I will tell you what it CAN do - at least for me.

I can take any program I've written to date and make it OOPS very simply.

Replace all FLIP() with YIELD(), then make a coroutine to run my MAIN() function. Done.

But it goes beyond this. Since I can now join the ranks of _DRAW() and _UPDATE() this means I can write a custom background engine that operates exactly as I like it.

In this case for this example you can hit "Q" and bring up Quick Debugger which shows memory usage and how much of the CPU is being tasked. You can also hit [ESC] and type RESUME to leave off where you where.

Before YIELD() I couldn't do either of these things nor read the CPU. Now I can. This does herald the END of FLIP() for me and the very welcome arrival of YIELD().

What does this mean for you ? YIELD() does not just exit a function it retains the exact position when you return even if you were nested in a whirl of FOR/DO, IF/END, and REPEAT/UNTIL statements. It also retains all local variables and values at the point you exit and return. That is immensely powerful.

Giving credit where credit is due. I found out about YIELD() from freds72 HERE:

and MBoffin HERE:


. . .

More and more I begin to appreciate this Pico-8 system and daresay it is the most powerful programming language I have ever come across.

P#68002 2019-09-22 16:47 ( Edited 2019-09-22 21:36)

Cart [#implosion-1#] | Code | 2019-09-21 | License: CC4-BY-NC-SA | Embed

Years ago I had written a QBasic program for Gina in Taiwan. In it, it imploded the map of Texas along with a greeting. When you ran it, it had the pixels come from all sides of the screen to implode the image I put in there.

Now you can do the same thing in Pico-8 !

Create any picture you want, call initexplosion() then explosion(1,flag) Flag to 1 if you want to skip seeing the explosion and only want to calculate for it. Then you are ready. Now call explosion(-1,0) to see the neat implosion effect of the image you put in there.

P#67980 2019-09-21 21:22 ( Edited 2019-09-21 21:24)

I first off wanted to let you know that I was just experimenting recording some .GIFs in PICO when I noted that the last .GIF I made was 6.49mb in size.

I loaded this up in VirtualDUB to check each frame in it, to make sure it looked alright, and then tried saving it back as an EXPORT .GIF to compare filesizes.

The filesize THEN was only 209k ! A 97% reduction !

I compared both. None miss frames, none have any distortion. They are the same EXCEPT that VirtualDUB has some massive compression going on there !

So ... Zep, someone, anyone ? the .GIF saver in current PICO-8 can definitely be optimized. No doubt about it. VirtualDUB was written 19-years ago - so it's not something new.

I can't upload the 6.49mb GIF in comparison here, says the filesize is too big.

Here is the 209k GIF though so you can see it's not missing anything. There's definitely good compression going on there !

I guess the good news is I've introduced a program (VirtualDUB) that will let users now save .GIFs of their cart directly in the BBS that can exceed well into minutes as they are so small in filesize as they are 3% the size of their original - and have the ability to edit out frames they don't want included in the presentation .GIF.

VirtualDUB is 100% Freeware and you can find it HERE:



P#67977 2019-09-21 18:36 ( Edited 2019-09-21 21:36)

Cart [#xor_flower-0#] | Code | 2019-09-19 | License: CC4-BY-NC-SA | Embed

Years ago computers had very little memory. I am reminded of the Apple ][ computer which although having 2-HIRES graphic pages each 8192-bytes in size with a resolution of 280x192 B&W pixels, you only had about 16k of RAM space if you used both of them for your program.

The original method was to plot an image on one page while viewing the other, then swap the two so you were always plotting on one while viewing the other. Yet this technique cost two HIRES pages of memory.

So a new method was adopted to handle plotting sprites and graphics over existing static images, and that method was called XOR.

On the Apple for instance you could plot a shape with XOR dots, that is for every pre-existing black dot you plotted on, it would appear white. Likewise if you plotted on a previously existing white dot, the plotting color for your dot would be black.

To erase the shape you would repeat the drawing exactly which would also recover the background beneath it - and this method only required the use of one HIRES page instead of the need for two so you could program in an additional 8192-bytes of code for your program, critical to many video-games that many years ago.

XOR also does some interesting graphic effects. If you XPLOT a line and then plot ANOTHER XOR LINE almost exactly like it but at a slightly different angle you can an interesting kind of warped box effect or flower as you see here.

Now as you cannot XPLOT a LINE in Pico-8, I wrote a routine to do just that for you called PLINE using coordinate arguments the same as LINE()(x1,y1,x2,y2).

So this cart is twofold, not only do you get a lovely mathematical flower but you can use this small coded PLINE() routine for your own works to have one target chase another, perhaps for your opponent to fire a shot at you despite where they are on the screen, or even just to simply draw a line changing color mid-step as you go.

It's up to you !

P#67910 2019-09-19 23:26 ( Edited 2019-09-19 23:43)

Credit to MBoffin who inspired me to write this, mostly so I myself could prove that I understood seldom used Pico-8 command set of COROUTINES such as COCREATE(), CORESUME(), and YIELD().

Cart [#cocreate_demo-0#] | Code | 2019-09-19 | License: CC4-BY-NC-SA | Embed

If you just want the source without the sound effects, that can be found HERE:

-- dw817's very simple
-- cocreate() program

function main() ------------->>




-- if press (x) or this is the
-- first time to run,
-- prepare for being able to
-- call function "act" as a
-- co-creation
if btnp(5) or init==0 then

-- make a pointer for the
-- cocreation function "act"
  sfx(0) -- low pitch

-- if press (o) then call
-- routine here to plot three
-- circles, one at a time, and
-- one for each press
if btnp(4) then

-- update screen

until forever
end --<<-----------------------

-- three circles, click (o)
-- three times to see all three
function act()
  sfx(1) -- high pitch

-- each time yield is used,
-- the position of where the
-- program is in the function
-- is recorded and the function
-- exits

-- the second time you press
-- (o) the function will start
-- here, not at the beginning
  sfx(1) -- high pitch

-- as above, this function
-- starts here on a 3rd press
  sfx(1) -- high pitch

-- there is nothing more here
-- so pressing (o) a 4th or
-- more does nothing.
-- you must call cocreate()
-- again in order to reset
-- this function to start
-- running the 3-circles again



P#67882 2019-09-19 01:51 ( Edited 2019-09-19 02:12)

My Father died nearly 20-years ago from today. Outside of my Sister and my Step-Mom, they are the only family I have now.

I remember my Step-Mom sending me the classic poem from Robert Frost.

And I remembered ... I remember when I was young.


So ... in tribute, I have two programs. One is to try and recreate that very program for the TRS-80 I typed in those so many years ago - and to have it run at the same speed.

Cart [#siparefiti-0#] | Code | 2019-09-17 | No License | Embed

The other is something a bit more magical. A year after the funeral I wanted to make SNOW, real snow, on the computer, and as accurately as I could. A majestic tribute to my Dad and that program typed in from so many years ago.

So I watched the movie, "Dr. Zhivago" and watched very carefully the snowflakes in them. One frame at a time. For many long days I studied their movements - and wrote down in my notes what I saw and what I observed.

[1] Few videogames to date apparently really follow the accurate movement of snowflakes.
[2] Some fall as fast as raindrops, big ones I believe.
[3] They do fall a bit slow and fast, based I think upon their shape.
[3] They are very light and airy and a slight wind will completely alter their course.

And today, I have what I believe is quite accurate for movement in snowflakes. And I had it available for GWBASIC in my S2 project, I had it for BlitzMAX, and now it is available - to you - for Pico-8, changing the math slightly to accommodate the larger pixels.

Please enjoy ...

Cart [#noyidotono-0#] | Code | 2019-09-17 | No License | Embed

P#67782 2019-09-17 01:07 ( Edited 2019-09-17 01:22)

I have never really liked to write code in BlitzMAX despite the fact it can work with a screen of 1980x1080 with true 64-million color pixels for a very simple reason. It takes time to compile the code and test it.

About 5-seconds to be precise, and that includes finding errors, even for a 2-line program.

My programming style if you are curious is a little like a rabid rabbit. It's like I take a cracker, nibble on it, look at it, nibble on it, look at it again, and nibble a little bit more.

That is - I write a bit of code, run it, add a bit more, run it again, then add a bit more.

My Dad was the opposite in that he could sit down and write a flawless program from beginning to end and NEVER have to run it once until he knew it was completely done. I can't do that.

So ... Pico-8 is a bit of my friend now for as you know when you RUN or press CTRL+R the language is already off like a shot and running.

Therefore I decided I could use it to write my Pico-8 website of favorite games.

And indeed I did.


All I'm doing is taking my text data file of:

# of stars
author's name
name of cart
description of cart
Actual cart ID name
Website where cart appears

Have a blank line separate, and then give the data for my next favorite cart if there is one, run my program, and the HTML to show what you saw above is saved and written.

So I wrote a program in PICO to read that text data and create a HTML file that has a neat and ordered table appear with the graphic cartridge and if you hover over any of them, you will get the number of stars, name, description, and author.

I even wrote it so it sorts all the data from highest number of stars to then on down so I don't have to do it myself manually. I could make it alphabetically sorted if someone feels slighted. :)

Here then is the program:

Cart [#muzikufawu-0#] | Code | 2019-09-16 | No License | Embed

Naturally it will not work in the BBS and is expecting a text file called, "list.txt" which has data as I described above. You need to LOAD this in immediate mode in PICO as follows:

load #muzikufawu

Here is a sample of the data to see what it is reading when it writes back, "web.htm"


Alfonzo's Bowling Challenge
Not your average bowling game.

Jack Of Spades
Turn-based RPG using playing cards.


You must have your data appear exactly like this. "list=[[" two open brackets, blank line, the cart info, another blank line, and two ending "]]"

Once your TEXT data is complete, save it.
Bring up NOTEPAD++ if you don't already have it open.

Open that TEXT data in there if you haven't yet done so.
Select from the menu, View, Show Symbol, Show All Characters.

If you see CRLF inverted then select from the menu, Edit, EOL Conversion, UNIX/OSX Format.

Then you should see only LF inverted which is the correct carriage return for PICO-8. CTRL+S to save.

Now, run my program. You can set DEBUG=1 to see each and every cart as it is processed. DEBUG=0 will just blur through everything and compile it quickly.

In your filer, delete "web.htm" if it exists. Rename "web.htm.p8l" to "web.htm"

Open "web.htm" in Notepad++ if you haven't yet done so. If you have and it's different from what the engine just created, you'll get a notice that the file has been modified and would you like to reload it ? Select YES.

Check the appearance. If the title's first character appears like this, ⭐150â then in the menu select, Encoding, Encode In UTF-8 Without Bom.

Then all the special characters will change to their designated icons. ⭐ and 🎮

Bring up your free website. If you can't think of any may I suggest TUMBLR ... or do you know of a good free site to build your website in ? Tumblr is 100% free and allows true HTML paste - which is what we need here.

In your "web.htm" tab in Notepad++ press CTRL+A to select everything there. Then CTRL+C to copy it to the clipboard.

Then in your internet browser in the area where you can type raw HTML for your custom website, press CTRL+V to paste the contents of web.htm directly there.

Save it, view it, enjoy it. :)

Please let me know if you do decide to use my code to build your own website or to assist you in this endeavor, I'd be curious to see it !

Once again, comments, questions, or kerosene. Let me know what you think !

P#67770 2019-09-16 20:30 ( Edited 2019-09-17 01:30)

The more I've been experimenting with the #INCLUDE command, the more I'm realizing that when you compile to an executable that - well ... you're not.

You can test this quite easily by using my homebrew Pico-8 compiler.

It's very simple.

-- external p8 compiler
-- written by dw817

-- note: you must compile this
-- program to exe in order to
-- use it

until forever

First, type out this code in the P8 source-code editor. Don't add anything else.
Save it. Run it. Press F7 for a screenshot even though nothing is there.

Now remove those 3-lines of repeat, flip, and until forever.

Go to sprites, mapper, sound, add stuff if you want. You don't have to.

When you're done with that, return to the sourcecode and add just below cls() the line:

#include source.txt

Now save this to a filename as a normal .P8 first. You'll get a warning that "could not #include file: source.txt". But don't worry about that. It worked. Then export as an EXE.

export engine.bin

Now with your normal filer, go inside the directory with the EXE, bring up NOTEPAD++

If you don't know what this is, you should get it. It is quite possibly the most powerful text editor on the planet, and it's 100% free.


Right, now start typing the source-code you want to have. Could be your own program. If you want sprites, mapper, or sound, you need to have created that above before you compiled to EXE.

Here is a sample program to test:

for i=0,127 do
  for j=0,127 do
  end--next j
end--next i
until forever

Now in NOTEPAD++ make sure you are saving LF only, not CRLF or CR which cannot be read in Pico-8.

To do so, click in the menu, Edit, EOL Conversion, and UNIX/OSX Format.

To ensure this is the case, from the menu, click, View, Show Symbol, Show All Characters.

Your custom program should now show an inverted LF to represent carriage-returns.

Save it as the filename, "source.txt" Make sure it is saved right where the EXE is located.

Now, you've saved your source-code which could be anything at all. It's time to test it.

Run the executable.

You will see your program run.

This points out something rather important. When you compile to an EXE it is apparently including the entire P8 system instead of creating an EXE that truly does bind your exact source-code to an actual original executable. otherwise it wouldn't know how to interpret the source text you just gave it. And it does.

Now this is not unknown behavior. Other languages I've programmed in such as Delphi Noetic F-Basic for the Commodore Amiga and GFA-Basic for Windows 3.1 all do this.

GFA was clever to create really tiny executables that worked so long as you had on path the main 3-megabyte DLL runtime library.

And we've seen this in countless interpretive programming languages. Both Integer and Floating Point Basic for the Apple ][ and GWBasic and Q-Basic for DOS.

So the real question now is, is this a security breach ? Possibly. Someone could indeed compile to an executable a blank program like I wrote above and then use an editor like NOTEPAD++ to post to SOURCE.TXT and run the executable each time to see their Pico-8 work executed.

Obviously this does not include the slick sprite, map, sound, and music editor. But it DOES work to compile any source-code at all.

Comments, questions, or kerosene ?

P#67671 2019-09-14 16:35 ( Edited 2019-09-14 17:24)

Zep, your front page HERE:


When I click on any of the games, the middle screen stays dark and does not load any game as intended.

I'm using Windows 10, 64-bit, Firefox Quantum v69.0.

If it doesn't work here chances are it doesn't work there for someone else. Thought I'd let you know ...

. . .

Solved. Just needed to clean the internet cookies for Firefox. Runs well here now.

P#67640 2019-09-14 00:26 ( Edited 2019-09-14 15:45)


Now that I've learned where the files are located, I've started to put together a little engine for myself that can create a nice list of Pico-8 games.

Here is what I've done so far:

sorry, had to shift some things around.

Hover over the cart to get a brief description and list the author.

Unlike embedding once you click the game it goes straight to the post in Lexaloffle where the game was released so not only can you play the game but read the author's comments, comments and questions from others, if you're logged in get a chance to add your own comments.

Special thanks to kittenm4ster and BoneVolt for their excellent programming and carts in the current list.

If it all looks okay, feel free to reply and post your game information and I'll add it to the list.

All I need is the URL address of where your game is (in Lexaloffle), it will look like this:
http: // www . lexaloffle.com / bbs / ?tid=00000

That and a brief game description of your game if it's not already included on the page, and that'll do it ! I can code the rest and feed it into my database.

If you're curious (not now but later) the list will be sorted by highest number of stars and go on down from there.

Or would you prefer they appear in the list on a first-come first-serve basis as they are now ?

Here is my table so far:

Alfonzo's Bowling Challenge
Not your average bowling game.

Jack Of Spades
Turn-based RPG using playing cards.

The Dead Should Die
A demake of the ghostly children in Little Nightmares, The Depths.

Not A Creature Was Stirring
(...Except Squeaky Whiskerson and his Marvelous Musical Mice!)

If I can remember I'll try to inject the list in every evening so you should always have an update and new cart every morning when you go to the game page.

. . .
Going to add the ability to sort the list by stars. I'll even post the code that is doing all of this once done. That's right, a Pico-8 program builds the HTML website !

P#67638 2019-09-13 23:54 ( Edited 2019-09-16 03:10)

Hello. As you know I've been recently experimenting with the new #INCLUDE command.

I have now recently found that if you use PRINTH it APPENDS text to a file, it does not overwrite it. If there is some way to overwrite the data, then this program could be run more than just a few times.


You can indeed load a text file as data for PICO-8. Modify it. Save it back. Then re-run the program to see all the changes recorded without having to save anything to SRAM or 256-byte storage.

One problem I ran into is that #INCLUDE can also not be used in a comparison. For instance, this:

IF 1==0 THEN

Will crash because it ignores any commands around it and WILL INCLUDE that data if it exists and crash if not.

Here is the program. It does work a few times. Can you make it so it's perfect and can be run over and over again ?

-- test load and save text file
-- by dw817

game_x={} game_y={} game_r={}

#include gamedata.p8l


for i=0,15 do

print"left for new name"
print"right to clear name"
print"up to clear circles"
print"down to create new circles"
print"press 🅾️ to save"


if btnp(⬅️) then
  for i=1,3 do
  end--next i
elseif btnp(➡️) then
elseif btnp(⬆️) then
  for i=0,15 do
    game_x={} game_y={}
    game_r={} game_c={}
elseif btnp(⬇️) then
  for i=0,15 do
elseif btnp(🅾️) then
  t='game_name="'..game_name..'" '
  for i=1,4 do
    for j=0,15 do
      if (i==1) v=game_x[j]
      if (i==2) v=game_y[j]
      if (i==3) v=game_r[j]
      if (i==4) v=game_c[j]
      if v!=nil then
        if j<15 then
    end--next j
    t=t.." "
  end--next i

until forever

NOTE, you WILL need to initially create a blank text file called, "gamedata.p8l" where you normally store your carts (notice that is an L on the end).

Then you must SAVE this program, any name, but must be in the same directory you just saved that data file in.

After this though it will work, about 3 times, then crash.

There needs to be some way of overwriting the "gamedata.p8l" instead of just appending data to it.

Once perfected this will be a remarkable and incredible way of loading and saving data bypassing the SRAM completely, and likely a lot more data could be loaded and saved this way, and a lot less coding to be involved since it's just source-code inclusion, modification, and saving. True self-modifying code.

But at this point I am truly stuck and not sure how to continue ...

P#67633 2019-09-13 20:40 ( Edited 2019-09-13 20:52)

There are not too many string-handling libraries I have come across in Pico-8. And for visual text this is not too surprising considering the small-size of the screen. :)

However, the point of this cart is to demonstrate a few things. One of which is that it is indeed possible to load a text ".txt" file inside your program. Now unfortunately the TXT file's contents cannot be changed once loaded. Like if you made a loop to view the contents each time.

But this does free you to use any other editor like NOTEPAD to prepare text data inside it.

For instance, you will need this. Highlight all of it, press CTRL-C. Bring up NOTEPAD. Press CTRL-V. Then save it on your HD as YUKON.TXT in a place you normally save your PICO-8 carts.


Day had broken cold and grey, exceedingly cold and grey, when the man turned aside from the main Yukon trail.
It was a steep bank, and he paused for breath at the top, excusing the act to himself by looking at his watch.
It was nine o'clock.
There was no sun nor hint of sun, though there was not a cloud in the sky.
It was a clear day, and yet there seemed an intangible pall over the face of things, a subtle gloom.
This fact did not worry the man.
He was used to the lack of sun.
It had been days since he had seen the sun, and he knew that a few more days must pass before that cheerful orb.
The man flung a look back along the way he had come.
The Yukon lay a mile wide and hidden under three feet of ice.


Notice it has correct uppercase and lowercase letters. If you want to make your own text file to use the libraries in this cart be certain to make your TXT file exactly the same way. With a variable "=" "[[" a skipped line, the data, another skipped line, and "]]" to finish followed by a carriage-return.

Cart [#textlib-1#] | Code | 2019-09-12 | License: CC4-BY-NC-SA | Embed

Alright, now load up this cart direct in PICO-8's editor.

load #textlib-1

The reason is this cart will NOT run either in Lexaloffle BBS or even compiled as an EXE - unless you have the TXT file alongside the EXE. And that could be a problem that needs to be resolved by ZEP. In any case, this =WILL= work in the editor once again provided you have the TXT file separate.

Now once you have the cart loaded, change to the directory where your TXT file is and SAVE your program right then in the same directory. Any name will do, but it must be saved in the same directory as the TXT file so PICO will know where to find it.

You will receive a warning that, "COULD NOT #INCLUDE FILE: YUKON.TXT" even though it's right there, but the file will have saved properly.

NOW IT WILL RUN. Run the cart.

Notice I am using a new function called PRINTS(). The reason is PICO-8 messes up the display if you use PRINT for any string that has \10 (CR) in it, and PICO-8 also has no internal word-wrap for strings. You must instead print out each character manually and handle CRs through code.

The advantage here also is now you can change the TXT file anytime you want and the results are immediately seen in your cart without the need to save it each time.

And that's it ! If you have any questions or difficulties, please let me know.

I hope you find this library useful for all of your import and string-handling needs.

P#67593 2019-09-12 18:23 ( Edited 2019-09-12 18:39)


Was watching a movie and thinking of some things I'd like to see in future PICO.

They go from perfectly acceptable to "GOSH that would be swell (but probably won't happen)."

Here we go ! First off, 2 errors:

!! Fix parenthesis error. This gives error: IF (K=="(") X=X-1 ... gives error because parenthesis is character to check.

!! Fix error with modulos when using high negative numbers. ?-32767%10000 yields 7233, incorrect.

added 09-23-19 option for two new variable types. One can have value from 0-65535 (16-bits) the other can have value from -2147483648 to 2147483647 (32-bits). If this is possible, it should also be possible to have high floating. 1E+38.

Currently CTRL+number keys (0-9) currently do nothing in editor. Suggest they jump to tabs if tabs are set in sourcecode.

Right-clicking the mouse with FILL mode in sprite editor currently just fills, same as left click. Suggest it eyedrop the color as it does in normal pen mode.

Add option to press CTRL-C during cart execution to not only stop program but jump the editor to the exact source-line where it was halted. Resume from here is available if desired.

Add new command POLYGON(), POLYGONFILL. Usage: polygon(arrayof2dpoints,color). Also OVAL(), OVALFILL(). Usage: oval(x,y,radii-x,radii-y,color).

Clear all Sprite Flags for single sprite with SHIFT-CTRL-C or some other such non-used key combination.

Change pen size with hot keys like CTRL - CTRL +. Also change edit size via CTRL , "<" smaller and CTRL "." larger. So by default you edit 8x8, press CTRL "." and then you are editing 16x16. Add CTRL "[" to decrease whole sprite page and ctrl "]" to increase whole sprite page. CTRL+P for PEN, CTRL+F for fill. Holding down left mouse button over a pixel for a short time enters selection mode. Once mouse button is released, returns to PEN mode.

added 09-22-19 option for circ() and circfill() to have arc, add argument of angle 0 to 1 or 0 to 359. IE: circ(x,y,size,color,start-angle,end-angle)

Option for rect() and rectfill() to have rounded corners, can specify depth. IE: rect(x,y,x2,y2,color,roundness intensity)


You can run LUA on the PSP-1000 models and higher. It should be possible to run PICO-8 as well.

There is a program to convert HTML to Android APK. It should be possible to run Pico-8 as well.

C++ can use variable++ to increase by one or variable-- to decrease by one. Suggest future PICO have this ability.

KEYCONFIG can only be used in immediate mode. If you try to run it in a cart, it only executes it when the program exits, this means of course you cannot use it at all for an EXE. Suggest copying over current key configuration to exports or allow KEYCONFIG inside someone's sourcecode.

Have ability to import or export graphic sections, not just all 256-sprites in one set.

[color=$ff0040]Have ability[/color] to change repeat speed for BUTNP(). Currently it's a tad slow. Likely others would want to change the initial delay for the first repeat and the repeat speed after. If it can be changed via source-code so much the better. setbutnp(1stkeydelay,repeatdelay)

This is pretty high-tech but would be nice to have. Once GIF is calculated via record video, maybe have a simple editor come up where you can delete individual frames (like where you are typing RUN) in the GIF before it is fully saved. I'm doing this in VirtualDUB currently, I think it could be done in PICO.

added 09-21-19 Option to turn off not just all sound but optional MUSIC() and/or sound effects. Some music is very good and some sound effects are very good, sometimes - not all at the same time. :) So there would be =2= menu options instead of just 1.

Also it has been proven through VirtualDUB that the animated GIFs you are saving via VIDEO in PICO-8 can indeed be compressed up to 97% the current size that you have. Might be worth investigating.


Currently hitting BACKSPACE goes back a webpage even if the focus is on the P8 cart in the BBS. Hitting the TAB key also selects from the browser. This makes a text entry mode difficult. Suggest that all non-vital keys be locked and available in the cart until focus is lost. Also turn OFF all audio when clicked outside CART would be good too - or better yet just FREEZE the whole cart until it's frame is clicked again. Whereupon it continues both with sound and position - exactly where you left it.

Right-mouse-click in the sourcecode editor currently does nothing. Suggest a menu may appear. Search, Search and replace, Undo, Redo, Copy, Paste, Erase, etc.

Add a new argument to PRINT after color. Use 8-bits for each of 1 2 3 4 * 6 7 8 9 to draw outline around text. IE:

for if only the 8th bit is set:

for if bits 2, 4, 5, and 7 are set:

for if all 8 bits are set:

for if value is -1:

(it creates a full rectangle despite the character's image)

If it is -1 instead draw solid rectangle around text (1-pixel around edges, rectfill()). Default to color black. If additional argument chosen, that is the outline color. This also applies to sprites spr() and sspr() so sprites can also have an automatic and colored outline.

PLEASE add a grid for the sprite editor ! Or at least make it optional - easier for others to work exact pixels in the 8x8 or 16x16 area. You already have SPACEBAR in map editor show grid, can do same for sprite editor, but make it toggle ON/OFF so spacebar need not be held all the time.

NOTICED that when you export to .BIN that it uses the default keys despite me remapping the arrow keys to the number keypad. Should be able to export using user selections - or add key configure in menu (only for exports).

added 09-20-19 allow color 16 or 255 to be BXOR. That is, 15 is automatically subtracted from the color beneath the plotter thus. PSET(X,Y,16) will plot color 15 if 0 is beneath and 0 if 15 is beneath. PSET(X,Y,15-PGET(X,Y)). Same with RECT() RECTFILL() CIRC() CIRCFILL() LINE().[/color]

Also, create new command, n=BUTNW(). It will pause execution and wait for any standard joystick keypress. N will then contain a value from 0-5. If you call it without a variable in front, it will just wait for any joystick keypress but not return a value. If you enclose a value in the argument BUTNW(n) then it will wait until that very button is pressed.

A few suggestions. These should all be achievable in the current version of PICO-8.

Add 128 to colors to plot with new color and to change that palette # to use the extended if it is >=128.
PLOT(X,Y,C) rect() rectfill() line() color() print()
if C>=128 then not only does it plot the new color but directly modifies the palette for that single color index (0-15) to reflect this. Add extra argument to rect() rectfill() and line() so can plot outline around color, use 8-bit as listed above for PRINT(), also specify outline color or black by default.

pal() can now access new palette additionally. pal(original color,new color (>=128 possible),normal flag)

Create 4 new commands that do the exact same thing END does.
To help make code more readable. Obviously you could use these out of order, say ENDIF for a FOR/DO statement, but the point is to clarify readability for programmers. NEXT can have anything after it, it is ignored. Useful so you could have NEXT followed by the variable name in the FOR/DO statement.

Allow usage of number keypad arrow keys same as arrow keys in source code editor. Same with DEL and ENTER keys. Currently these are all disabled in the editor.

Every time you run your program it auto-saves your program as either the name you gave it or a default "backup" name to a backup directory.

Have an option (click-switch) to view source-code with tabs as normal or to view them as if they weren't there (source is all on one page).

Allow clipboard to be read and written to when running directly from lexaoffle. Currently it is prohibited.

Reading and writing to clipboard could be a way to save complex work as 7-bit encoded text including complex game progress passwords and custom data work if it's a type of miniature game-maker. If you're concerned about security, only permit 7-bit reading and writing of clipboard, characters #32-#126 only.

If that's not enough, limit the selection to up to 256-characters.

Never use print a value using black ink on a black background when in immediate mode typing out 'print(a)' or whatever. Instead default to color 6 if color 0 is found to be printing color. This could be configurable if someone really does want black ink on a black background by default.

Option to read off edge of screen as -1 instead of 0 (zero).
Option to read off sprite edge as -1 instead of 0 (zero).
Option to read off map edge as -1 instead of 0 (zero).

Option to read TRUE and FALSE as -1 and 0 (zero). This would help complex logic statements that involve math. I'm not the only one requesting this.

Have Fill pattern to a character not just for cross-hatch characters but ALL special icons including arrows, circle, X, etc.

Option to base all arrays starting with zero instead of forcing it via: count={[0]=0,1,2,3}

Option for PRINT with two arguments, the 2nd argument is now not X but color. New color applies if >=128

Add command to play pitch and duration bypassing need to create sound effects via table. Most early programming languages have this. SOUND(pitch,durat,type,flag) flag if TRUE means it will wait to play the full sound before continuing to run the rest of the code. ESC will always abort sound and program early. Type is instrument type. 6 being noise. If any arguments are missing, including first, defaults will be chosen. SOUND() defaults pitch, durat, type, and flag to default values.

Option to print normal text as reverse-case so if you import the string "Hello" it does not come out "hELLO" but instead correctly "Hello."

. . .


WAIT(a,b) ... wait value of 1 means to wait 1/1000th of a second. 1000 means to wait one second. If b is TRUE then also does screen update.

INPUT will allow someone to enter normal input, string only, integer only, or real value
I.E.: INPUTS(name) ... will bring up an input with optional keyboard (if Android) and let someone type in their name, accepted with CR or even spoken through microphone for cellphone, etc.

Using $ in a variable name forces it to be a string. No need for TOSTR()
Using % in a variable name forces it to be integer. No need for FLR() or CEIL()
Using # in a variable name forces it to be real. No need for TONUM()

Add new command. RAND. Rand (15) yields random integer number from 0-14. RAND(1,6) yields integer number 1-6.

SRAND(0 or a negative number) could clear the random seed and return it to normal

SORT(V,TYPE). Sorts an array. If type=FALSE sorts in reverse. If TRUE or not included sorts ascending by default. if SORT is called with no variable before it SORT(V,TYPE) instead of res=SORT(V,TYPE) then results are sorted directly into input array

New command. INSTR() to search for a string within a substring. PRINT INSTR("APPLE","PL") yields 3.
New command. RINSTR() to search for a string within a substring in reverse. PRINT INSTR("APPLE,"P") yields 3.

New command REPLACE() to replace all occurances of string within string recursively.
dessert="APPLE PIE"
chang now contains "CHERRY PIE"
if done without argument, just REPLACE(dessert,"APPLE,"CHERRY") then variable dessert is modified directly

New command CHAR(Str,I) to return a single character of a string, shorter version of SUB(Str,I,I)
New command MID(Str,A,B) to return a parsed string position A length of B. This is different from standard SUB()

New command FORV. This is similar to FOR/Do with the exception that the variable it uses can be manipulated and could be previously defined, for instance.

FORV I=1,10 DO

will yield: 1, 3, 5, 7, 9
After the loop it would contain 11

RECT2() to draw a rectangle where 3rd and 4th arguments are not x2 and y2 but width and height,
same with RECTFILL2()

Collision check with SPR() and other SPR() by pixel.
IF COLLISION(spr1,x,y,spr2,x,y,xtra) return FLAG of 2nd sprite, xtra means to not check pixels, just 8x8 area colliding

COLLISION2 is same but returns FLAG of 1st sprite, also xtra to not check pixels just 8x8 area colliding

IF MAPCOLLISION(spr1,x,y,xtra) where x and y are true location in map. Return value is FLAG of tile sprite if collision. Like above xtra if TRUE means to not check pixels but 8x8 area colliding.

I would really like these next ones, READTEXT() and WRITETEXT()
Read and write true text files, also higher level access directory. Can only read and write to text .TXT file for security.

mesg=READTEXT("message.txt") mesg now is a single string and contains every character from message.txt file
hisc=READLINES("hiscore.txt") hisc now has an array with as many elements as in text, one per CR delimited line. 7-bit text "@clip" is also possible.

WRITETEXT(hisc,"hiscore.txt") saves an array with as many elements in there as external text file
WRITETEXT(mesg,"message.txt") if not an array, instead saves the single string as the entire single file
7-bit text "@clip" is also possible.

next line asterisks do not appear properly, replace # with asterisk when reading
DIR(dir) where dir is a string that can contain "#.txt" to see only txt files or "#" to see every file
also use "flip#" to show every file that begins with "flip"

see=READDIR(dir) SEE now has an array with as many elements as from DIR(), one per file listed

DELETE(filename) - for safety file type can only be .TXT.

RENAME(filename1,filename2) - for safety file type can only be .TXT.

There should be no ability to delete directories. Keep it safe.

WEBSITE(url) ... loads website with default browser and opens accepted so long as URL address beginning has, "www.lexaloffle.com" to confirm staying within Lexaloffle community.


Read and write shared messages. Possible to make CHAT this way.
ANYKEY() ... is TRUE if user has pressed some key, any key, usually followed up by SEND, do not wait for key
SEND(string) sends string to everyone running this program now

ACCEPT ... is TRUE if someone has sent a message remotely and not yet been received locally, usually followed up by RECV. This is on a first-come-first-served basis. If there are several messages, it gets each of them one at a time.

RECV(string) empty until someone sends a string via ACCEPT()
For safety, strings cannot be more than 64-characters each. (256 also if you like, should set a limit though)


  END --endif
  END --endif
UNTIL FOREVER - - (loop forever)

That's it for now ! I'll try to post a new cart tomorrow should be of interest.

P#67574 2019-09-12 04:31 ( Edited 2019-09-24 04:03)

Cart [#notabs-0#] | Code | 2019-09-11 | License: CC4-BY-NC-SA | Embed


There are a few kinds of Pico-8 programmers out there. Those who like tabs and those who do not.

I fall into the latter category. So - what is the best way to remove tabs ? Well sure you can do it yourself - or you can rely on my rusty trusty Pico-8 program to do it for you !

NOTE: This program should be run NOT online but in LOCAL mode as it saves a file to your hard-drive, the corrected .P8 file called, "notabs."

Now at first I was using an index to read the string, but of course numbers only go up to 32767 so I had to use a different method. The code now will accept a program of ANY size now. Quite nice.

To use you have a few choices. If you know for instance that the code does NOT use the shift letters to create the Up, Down, Left, Right and other fancy icons in the source, you can use good old notepad.

Load up the .P8 file there. Run my program. Then copy all of the notepad contents (CTRL+A) (CTRL+C) to the clipboard. This is important to do in this order as when you first run my program it CLEARS the clipboard data first.

Right, then press CTRL-V. Press (O) to accept and after a short moment, whammo, you have a newly saved file called notabs.p8l ... be aware there is a trailing "L" on the file !

Rename to take it out and you're all set. Now if it crashes because of hitting a custom icon or arrow key, you'll have to load the original P8 in a more robust viewer like FIREFOX as an offline text file.

THEN run my program, open the P8 as a local file in Firefox.Press (CTRL+A) (CTRL+C), return to my program, press CTRL-V, and the P8 it saves should then run perfectly.

There may be an easier way to do this - but not with Pico-8 I think. :)

Any way to LOAD a text data file would be awesome, don't think that's going to happen though.


P#67516 2019-09-11 01:12

It's the first time I'm using the PICO-8 clock. Was just experimenting.

The time of this writing is:
09-10-19 at 1:29pm.

Let me write some code to confirm this:

until forever

Yet when I run this the HOUR says 18. Looking at the clock on my computer though it still says it's 1pm + 32-minutes. What gives ?

P#67487 2019-09-10 18:33 ( Edited 2019-09-10 20:13)

by dw817
Cart [#tdsd-9#] | Code | 2019-09-10 | License: CC4-BY-NC-SA | Embed

UPDATES: (that's all for today 09-09-19)

bugs + changes + fixes:

  • added new picture logo

  • stepped down the difficulty and checked game to level 16
    i believe it's possible to beat it now

  • change color each new level for mission specs

  • lowered volume of giggling, yeah we had enough

  • fixed nasty bug where 2- or more would collide and fight each other for their desired location.
    now they shake hands and take off independently

  • added debug to show all activity
    you can also cheat quite thoroughly in this mode. :)

  • added display in corner to show remaining ghosts

  • fix mistyped variables, there were a few

  • allow collision with defeated ghosts (both ways)
    also move them off map just to be sure

Alrightee then !

I've been playing Little Nightmares for about a year now and am really quite fond of it.

What I wanted to do in the spirit of upcoming Halloween was a DEMAKE of the scene where the boy is in THE DEPTHS with his flashlight and must get past the evil ghost children to the next room.

What made this especially interesting is the flashlight would burn them if it was on them long enough But they also hid behind every shadow they could find in the house to avoid the light. It was quite tricky and frustrating to find them all to make it to the next room.

This demake features quite a bit of the same brain behind the Little Nightmares game. You enter a room where there are obstacles that you cannot cross (the blocks). But the ghost children can quite easily cross them with the advantage to you is you can see their silhouette when they run past them.

However when they are not on top of something solid, you cannot see them at all - except with your flashlight.

Your flashlight costs nothing and you should totally use it as much as possible. Not only is this your only weapon in the game but you can see where they are hiding.

Now the children are smart. Once the light hits them they will usually high-tail it out of there to hide somewhere else invisibly. Your best method is to try and follow their trails when they pass through solid objects and keep that beam on them till they burn up.

If you do you'll get them and you'll hear a little wail to let you know you did. Now they heal too so if the light is not on them and you have burned them. Outside the light they will recover their damage (which is pretty quickly).

Once fully recovered from damage they'll giggle and turn invisible to let you know your efforts were for naught.

If you take too long they'll really get mad and turn visible and then dive straight for you !

You start with 3 lives and you can only be hit twice by them to lose a single life. When you are hit the first time you are invulnerable for just a second - and it's up to you to get out of that dangerous situation before you are hit again.

Your player is aqua and the ghost children are ... well, they are invisible actually. You can see them as BLACK when inside the walls and they turn dark blue if on the edge of the wall. You can also see them if you are up close to them but I don't recommend it.

When the light is on them they burn orange and yellow.

But they won't stay in the walls.

If one of the children moves to the inside of the wall, they won't like it and will choose a new hiding place. It's up to you to track their movements this way.

You'll know you got them all on a level because the lights will turn on. Prepare yourself for the next level then.

The levels of difficulty increase both the number of children and the time it takes to burn them with the flashlight.

Also sometimes one of the children can become fatigued and will just sit without defending. They'll do this if they've been running around for a long time. The advantage is they don't recover their strength after this and they're fair game to your flashlight.

You gain a bonus life every 4-levels of play. How far can you make it ?

Note, there may be ERRORS in the game ! I hope not. I have really worked trying to make it so it isn't. If you come across any, please screen-capture and send to me so I can try to find out what it is.

I've testplayed this quite a bit and so far it looks pretty stable. Please let me know !

reset to level one, lives equals three

P#67442 2019-09-09 20:35 ( Edited 2019-09-10 02:53)

Surprisingly with all the updates PICO-8 has received, it has one gross error in it that took me hours to debug and later find out and break it into the exact components giving the error alone. It was definitely a case of "it's not my fault." Could cause problems later in other carts and programs.

This will not run:

if (key=="(") print"open"

This will also not run:

if (key==")") print"close"

This will run:

if (key=="[") print"open"

Wow. And no-one's discovered this till now ??

P#67302 2019-09-05 21:02 ( Edited 2019-09-06 04:08)

by dw817
Cart [#nhr-4#] | Code | 2019-09-05 | License: CC4-BY-NC-SA | Embed

Update: Added GRAY, bars, text, Hopalong Cassidy


As you know, a new palette method was discovered. Now while you can't use all 32-colors in one screen (which is what I had hoped), you CAN tweak individual palettes of the 16 to use the new set.

This means for those of you who want to make games that use only one HUE, then you might find this program useful.

It shows 6-squares going from darkest but not black to each color of purple, red, orange, yellow, green, and blue, using the (O) key to change between, and the coding involved to produce it.

I have since added a picture of Hopalong Cassidy. This was not easy. First I converted a square picture of him to 128x128 B&W. Then manually created a palette based on the 7-colors that comprise of (Gray). Then reissue the image using that palette.

Then manually modify the palette only to default PICO-8 standard. Import. Re-hue, done. He looks best in the GRAY hue because that is the picture he was originally, B&W.

Would be keen to have optional 16-shades of B&W. :D Maybe next PICO-8 release.

Note, the color bars and squares are still there, change value HOPALONG=0 in the program and re-run.

P#67290 2019-09-05 17:05 ( Edited 2019-09-05 20:15)

Cart [#wall_jump_platformer-4#] | Code | 2019-08-31 | License: CC4-BY-NC-SA | Embed

Alright, well believe it or not this would actually be the FIRST platformer I have ever written, one where you have an actual map to navigate let alone a wall-jumping sprite.

Years ago I did make some action games that worked on grids using HIRES and LORES on the Apple computer, but as I got older I wanted more and more to make turn-based thinking games relying less on human-made maps and more on computer-generated - and that is my primary focus today.

Well - this is certainly not what is happening here.

In any case, it is complete, and hopefully others can learn from the code and make good carts from it.

The first thing it does is create a sample playfield for the player to explore.

Then you have a cursor letting you place your player sprite. Use arrow keys to navigate the 64x32 area and press O to do so.

Finally you are in Testplay. Arrow keys control the player. Press O to jump and X to return to select player position.

To Wall Jump, jump then hit a wall just as you are getting ready to fall. Your player will grip the side of the wall and then fling off in the opposite direction. You can use this to climb a narrow chimney for instance.


P#67082 2019-08-31 19:52 ( Edited 2019-08-31 20:26)

View Older Posts
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-09-24 09:57 | 0.184s | 4194k | Q:186