Log In  
[back to top]

[ :: Read More :: ]

Alright so you've been using PICO for a-while now and have gotten used to the limitations on the sound. But then occasionally you come across a snazzy cart that has sound you are CERTAIN is just not possible with the limitations of Pico-8, or so you think.

So what gives ?

Well let's see if we can discover what's going on. First off save off the work on your current cart and REBOOT.

Let's start with a clean slate. Press the ESC key and ALT-RIGHT arrow key three times and TAB until you are at the sound editor.

Let's start with something basic. The rain sound. To make this, type out the following. You can create that "C" with letter Z.

Then click on the right-most number of LOOP to 1 so it shows LOOP 00 01 and press SPACEBAR to hear it.

Familiar. But is that as low pitch as the sound can go ? Well, yes and no.

Let's now discover something new. Hit SPACEBAR again to stop playing. Now, do you see that tiny little button just below the 2nd number for LOOP. Well, click on it.

Now this is different ! Your waveforms have been replaced with digits now 0-7 and you can see the button is active as it is GREEN.

Hit = and TAB to go to the next sound. From here, type out:

NOTICE the center number is no longer PINK but GREEN. This is a special case.

Set the loop here to 00 and 01 like the first sound and press SPACEBAR.

Well there's a sound you haven't heard in PICO before. So what's going on here.

When you use GREEN for your note instead of PINK you will be using THAT sound # as the instrument itself. In this case, you can see the zero is green so it means we are using the 1st sound as OUR instrument and are telling it to play it at an even lower pitch.

For low sounds you likely won't get much improvement as the audio is pretty raspy to begin with. But for high-pitch ? Well, let's try an experiment, shall we ?

Hit = and TAB again to go to the 3rd page for sounds. This time we're going to leave the LOOP at 00 and 00, but we ARE going to do something tricky.

Try this. First off hold down the "." key until your SPD is 255. We want it to play a good long time. Now type out the following:

Let's take a look at it letter per number.

It has a C so that's just the note. The next is is pitch, high as it will get. The GREEN number says to use - well - to use THIS sound as its instrument. This oughta be interesting. The next is 7, loud, and the last, the warble effect.

Get ready to hear a sound you've never heard in PICO before ! Press SPACEBAR to hear it.

Hope that didn't scare the cat ! :D

What's going on here ? Well, you're doing a feedback essentially. Like when a microphone gets too close to the speaker. You get this interesting warbling feedback effect. You could also get this trying to tune an AM radio.

So let's recap. The green number then means to use the SOUND # (0-7), sorry there are no more, to use as an instrument. So ... How could we use this to our advantage ? We've still got a bit of space. Let's do something fancy indeed.

If you have trouble typing this in, there's a copy of this cart at the end of the document.

Now on the next page have the following:

Notice that we have speed here set to 255 as well. So what do you think will happen ? Press SPACEBAR to play and find out.

Ah ! So it is indeed possible to play a sound that has tones as a single instrument itself and most importantly CHANGE THE KEY it is playing in.

And of course you can play something really high pitched as the instrument and then use a 2nd sound to play it even higher pitch getting some interesting sound effects not possible before this.

What amazing sounds will you discover ? Feel free to share.

Here is the sound set I put together.

Cart #jumugujido-0 | 2019-10-03 | Code ▽ | Embed ▽ | No License
1

HOPE THIS HELPS !

P#68406 2019-10-03 17:14 ( Edited 2019-10-03 19:34)

[ :: Read More :: ]

Yep, I'm still working on my Sprite/Flag routine.

Yet I left one of my other items running in the background in a separate Pico-8 tab last night, awoke to see that it said:

OUT OF MEMORY

Well the next morning I cleared the slate and started new code for it:

cls()
print"testing"
repeat
until forever

About 12-hours later it crashes and says:

OUT OF MEMORY

Now I don't think there's any recursion involved in this, but if it's running out of memory just by doing a loop, it could be a problem for others coders, right ?

And yes, I know "forever" is a NIL statement.

Nonetheless for it to crash, thoughts ?

P#68336 2019-10-02 00:31 ( Edited 2019-10-02 01:14)

[ :: Read More :: ]

Cart #map2bbsimage-1 | 2019-09-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2


To load this, in PICO-8 type:

load #map2bbsimage-1

[8x8]

[8x8]

MAPPER2BBSSPR(X1,Y1,X2,Y2)

This function will take coordinates from a cart of your choosing and let you specify from your MAPPER (x1,y1,x2,y2) where x1,y1 is top-left-hand corner of your map and x2,y2 is bottom-right-hand corner of your map to convert it to a BBS image that can be pasted in the forum.

It also clears the screen and shows you what was transferred so you can be certain you have the right image.

This is useful for collaborations on bigger projects and demos so you can share what you are working on in the mapper without having to use screen-capture, multiple pastes because it goes past the screen, or even lose sharpness or clarity because of a dithered resize.

Sample sprites and mapper data are included to get you started. Function is one-line so just copy that one-line to your project and run it from there.

IF YOU USE PLEASE LET ME KNOW !

P#68223 2019-09-28 14:31 ( Edited 2019-09-28 20:12)

[ :: Read More :: ]

as
by dw817
Cart #as-0 | 2019-12-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

TO LOAD THIS CART in Pico-8 immediate mode, type:

load #as]

(12-31-19) Added youtube video comparison.

It's difficult to emulate some of the wondrous things that are done in arcade games. One of which I was especially fond of is when Galaxian first made the scene as a space shooter. It had tiny stars that were colored and they flickered perfectly.

Here now is one function to do just that for you. Include in any of your space shooters. Just add to _draw() or _update(). Fire and forget. You don't even need code to initialize the stars as this is also covered in my one function.

Compare with original:

HOPE THIS HELPS !

P#68205 2019-09-28 01:02 ( Edited 2019-12-31 18:44)

[ :: Read More :: ]

Cart #str2board-0 | 2019-09-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

This program may not be too useful for you Pico-8 veterans but may prove instrumental to those learning the system or want an easy route to build their own mapper.

Obviously you can use the MAPPER if you want, but if you don't want to or can't, you may find this code to be of interest.

Here is the top of the source to show you what is going on in it.

As you can see it is a single string, 240-characters in length that uses only the special characters for Pico-8. If you check out the sprites you have:

Where you can replace each letter of the alphabet here with your own custom image. Then in the source editor, press SHIFT followed by that letter to enter in that character for the string in your board.

Run the program to see the results and build your own original game around this.

IF YOU USE PLEASE LET ME KNOW !

P#68201 2019-09-27 22:03 ( Edited 2019-09-28 19:07)

[ :: Read More :: ]

vvm
by dw817
Cart #vvm-6 | 2019-09-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1


To load this cart, in Pico-8 immediate mode type:

LOAD #VVM-6

UPDATE: 09-27-19

  • Sped up load/save to external file process considerably by using internal temporary storage.
  • Converted loose initialize to function.

  • Added "Skeleton" file to make it easier for others to use. Includes the only 3-functions you need to make it work, but for loading and saving. Found HERE:
    Cart #vvm_skel-0 | 2019-09-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
    1

-- skeleton file
function _init()
  initvar()
end

function _update()
  var.test="ready"
  var2file("*")
  stop()
end

function _draw()
end

function initvar()
function var2file(filename)
function file2var(filename)

To load this cart, in Pico-8 immediate mode type:

LOAD #VVM_SKEL-0

UPDATE: 09-26-19
Added ability to recall all software changes to sprites,mapper,sounds, and music even if you change them via POKE() in your code. Before after you loaded or saved your VARS it would only reset to what you have default in your cart. Code is a little slower because of this but works fine. New temporary file "_" is created because of this - but data is not affected.

. . .

Back when PICO-8 first came out, it was announced that you could load and save externally 64-numbers per cart. And life was good.

Then someone realized that this is actually 256-bytes and wrote routines to directly access that memory. And life was better.

Another person took that and said that 256-bytes could be broken down to 2048-switches. 8 bits per byte. And that was an interesting find to say the least.

Now me ? I've always been interested in compression - ever since I created S2 those 20+ years ago and wrote in it, that's right, the same name but a different method, a Virtual Variable Minder to keep track of all of my player and companion attributes and inventory.

I've also been experimenting with memory storage and recall in Pico for years now. At one point I wrote code that let you save up to 4096-bytes of memory at the cost of half your sprite space. It was good but the disadvantage was that you could only have one-save file per cart. I know this could be improved upon if I worked at it.

So now that ZEP has finally fixed the memory problem I was experiencing in an earlier version of PICO, I am successful - and do have a good grasp of how to work with up to 12288 bytes of memory that be both loaded and saved to an external file and touches no sprites, no mapper, no sound, and no music memory. And you can have as many as you want. You will find how in the routines I wrote here.

Now it is only recently I have discovered the use and power of "Variable dot." That is, any variable followed by the period key. The real advantage is that you can set any variable with it and later recall all the variables that match the prefix with my DLLs (and that's what I'm calling these routines).

In this, I have written 2 useful functions. One of which will save all your vars to any filename you want. Works everywhere:

  • immediate mode
  • EXE export
  • run in Splore
  • run in Lexaloffle's BBS
  • offline HTML export

It truly does work everywhere. And you can still have any number of files no matter the port.

No need for messy arrays, pokes, or anything like that. I have done all this work for you. Here are some examples of variables that can be loaded and saved easily in one pass.

var.name="george"
var.newname=""
var.hits=100
var.maxhits=250
var.expr=0
var.encounterrate=2.25
var.map={}
for i=0,15 do
  var.map[i]=i*3
end
var.equip={}
var.equip[2]="bronze sword"
var.equip[41]="silver armor"
var.equip[836]="wooden shield"
var.equip[1531]="copper helmet"
var.equip[25493]="leather boots"
var.flag={}
var.flag["key"]="gold"
var.flag["wand"]="ruby"
var.flag["apple15"]="delicious"

As you can see you can have quite non-standard variables as well. To save these call the function, VAR2FILE(filename). If you just want to view all the variables for debugging, choose the filename of "*" instead.

To load back your variables (and it doesn't need to be the same cart), call the function FILE2VAR(filename) where the filename is the same as the one you chose above.

And YES this does mean that you can indeed save multiple files since the filename can be anything at all and well exceed 65536 bytes of storage or even more.

There is one catch, I am using the "{" and "}" keys as markers for variable data storage and recall. Do not use these two-characters in any capacity for strings or string arrays. You do that and my program will work just fine.

I am also adopting a new stance. Years ago back in BlitzMAX DLLs were bandied about quite a bit. These were very popular often over standard released sourcecode in that you could "fire and forget" without ever having to worry about the actual source-code itself.

Therefore I am hanging up the cape of the dw817 laboratory. Instead it will be the dw817 Magic Shop. Good powerful routines but each in one magical line of code instead of 20-30 with massive remarks like I did earlier.

So too have I done that with these functions. They are each only one-line long and written about as small coding as is possible for me. You copy those two-lines plus the one line to initialize your "VAR." and you're DONE. No need for anything else - should work in any program and in any capacity.

Thanks especially to those who helped me understand dot variables and how to view them all via PAIRS(). I could not have done this without you !

Included now is a full cart demonstrating its ability to both load, view, and save. Notice when the variables are viewed for debugging that I have made use of { } in data separation.

IF YOU USE PLEASE LET ME KNOW !

P#68171 2019-09-27 00:45 ( Edited 2019-09-28 19:05)

[ :: Read More :: ]

I had discovered where the configuration file for Pico-8 was for binary export and came across an option in there:

fullscreen_method 1 // 0 maximized window (linux) 1 borderless desktop-sized window 2 fullscreen

Whatever you do DO NOT choose option 2 and run your cart. I had thought hardware snap was a thing of the past but apparently it's possible to do in Pico-8. You do NOT want to choose this as your monitor literally SNAPS to try and match the hardware resolution - which mine couldn't so the whole keyboard and mouse locked up and garbage appeared on my screen of other previous window tasks.

Fortunately I managed to shut down my computer and reboot. In the past techniques like this could physically damage your monitor and definitely royally crash your computer.

ZEP may I wholeheartedly recommend you REMOVE this option at least for Windows executables. No Windows software today should ever need hardware snap with the advanced graphic cards we have.

P#68102 2019-09-24 15:46 ( Edited 2019-09-24 21:19)

[ :: Read More :: ]

Hello.

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

var={}
var["playhp"]=500
var["playname"]="patrick"
var["wepname"]="dagger"
var["wepstr"]=2

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

And yes, I know I can use:

var={["playhp"]=500,["playname"]="patrick",["wepname"]="dagger",["wepstr"]=2}

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

var["playhp"]=nil

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

varname="playhp"
print(var.@varname) 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)

[ :: Read More :: ]

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

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:
https://www.lexaloffle.com/bbs/?tid=31359

and MBoffin HERE:

https://www.lexaloffle.com/bbs/?tid=35381

. . .

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)

[ :: Read More :: ]

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

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)

[ :: Read More :: ]

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:

http://virtualdub.sourceforge.net/

HOPE THIS HELPS !

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

[ :: Read More :: ]

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

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)

[ :: Read More :: ]

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 | 2019-09-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

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

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

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

cls()

init=0

repeat

-- 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
  init=1

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

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

-- update screen
flip()

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

-- three circles, click (o)
-- three times to see all three
function act()
  circfill(10,10,10,5)
  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
  yield()

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

-- as above, this function
-- starts here on a 3rd press
  circfill(30,10,10,7)
  sfx(1) -- high pitch
  yield()

-- 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
end

main()

HOPE THIS HELPS !

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

[ :: Read More :: ]

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.

https://www.writerscafe.org/writing/dw817/1260511/

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 | 2019-09-17 | Code ▽ | Embed ▽ | No License
8

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 | 2019-09-17 | Code ▽ | Embed ▽ | No License
8

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

[ :: Read More :: ]

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.

https://dw-817-blog.tumblr.com/

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 | 2019-09-16 | Code ▽ | Embed ▽ | No License
8

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"

list=[[

41
Alfonzo's Bowling Challenge
kittenm4ster
Not your average bowling game.
abc-0
https://www.lexaloffle.com/bbs/?pid=66371

12
Jack Of Spades
BoneVolt
Turn-based RPG using playing cards.
jostitle-5
https://www.lexaloffle.com/bbs/?pid=65294

]]

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)

[ :: Read More :: ]

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

cls()
repeat
  flip()
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.

https://notepad-plus-plus.org/download/v7.7.1.html

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:

repeat
for i=0,127 do
  for j=0,127 do
    pset(j,i,rnd(16))
  end--next j
end--next i
flip()
holdframe()
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)

[ :: Read More :: ]

Zep, your front page HERE:

https://www.lexaloffle.com/pico-8.php


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)

[ :: Read More :: ]

Hello.

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:

https://dw-817-blog.tumblr.com/
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:

41
Alfonzo's Bowling Challenge
Not your average bowling game.
kittenm4ster
abc-0
https://www.lexaloffle.com/bbs/?pid=66371

12
Jack Of Spades
Turn-based RPG using playing cards.
BoneVolt
jostitle-5
https://www.lexaloffle.com/bbs/?pid=65294

3
The Dead Should Die
A demake of the ghostly children in Little Nightmares, The Depths.
dw817
tdsd-9
https://www.lexaloffle.com/bbs/?pid=67442

31
Not A Creature Was Stirring
(...Except Squeaky Whiskerson and his Marvelous Musical Mice!)
kittenm4ster
nacwseswahmmm-2
https://www.lexaloffle.com/bbs/?pid=59784

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.

. . .
(09-14-19)
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)

[ :: Read More :: ]

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.

BUT IT DOES WORK.

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
#INCLUDE DOESNOTEXIST
END

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

cls()
game_name=""
game_x={} game_y={} game_r={}
game_c={}

#include gamedata.p8l

repeat
cls()
print("name="..game_name)

for i=0,15 do
  circ(game_x[i],game_y[i],game_r[i],game_c[i])
end

color(6)
print("",0,90)
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"

flip()

if btnp(⬅️) then
  game_name=""
  for i=1,3 do
    r=flr(rnd(17))+1
    game_name=game_name..sub("bdfghjklmnprstvwy",r,r)
    r=flr(rnd(5))+1
    game_name=game_name..sub("aeiou",r,r)
  end--next i
elseif btnp(➡️) then
  game_name=""
elseif btnp(⬆️) then
  for i=0,15 do
    game_x={} game_y={}
    game_r={} game_c={}
  end
elseif btnp(⬇️) then
  for i=0,15 do
    game_x[i]=flr(rnd(128))
    game_y[i]=flr(rnd(128))
    game_r[i]=flr(rnd(16))+16
    game_c[i]=flr(rnd(15))+1
  end
elseif btnp(🅾️) then
  t=""
  t='game_name="'..game_name..'" '
  for i=1,4 do
    t=t.."game_"..sub("xyrc",i,i).."={"
    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
        t=t..v
        if j<15 then
          t=t..","
        else
          t=t.."}"
        end
      end
    end--next j
    t=t.." "
  end--next i
  printh(t,"gamedata")
  sfx(0)
end

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)

[ :: Read More :: ]

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.

text=[[

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 | 2019-09-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

THIS CART WILL NOT RUN IN THE BBS

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)

View Older Posts