Log In  

I like pixeled graphics and chiptune sound game.
i'm making game like metroidvania.

KNUTIL Scene Manager Library
by shiftalow
pelogen (3D modeling tool)
by shiftalow

One-off characters [8 chars of raw binary data] print unnaturally.

Or I may not understand this feature.
I was aware that "\^.00000000" would print nothing.

P#71332 2022-04-17 12:38 ( Edited 2022-04-18 14:05)

Setting Tab stop controll code to 0 and outputting tab characters at the same time causes pico-8 crash.

pico-8 version:0.2.4b

P#72157 2022-04-05 13:53

Cart #rceach-0 | 2022-03-30 | Code ▽ | Embed ▽ | No License

Feature Overview

RCEACH() performs a two-dimensional loop in a single function.

  • The rectangle value arguments correspond to [table] {x,y,w,h} and [string] "x y w h".
  • You can refer to the current x and y values in the specified function.
  • This function consumes 50 Token.
 local c=(x+y)%8+8

One of KNUTIL's functions, the object generated by EXRECT(), has a rectangle value format to be used for the RCEACH() argument.
may want to Use DMP() if check the converted table.
This function is included in the KNUTIL library.

P#72450 2022-03-30 10:32

Cart #tablemap-0 | 2022-03-21 | Code ▽ | Embed ▽ | No License

Feature Overview

TMAP(), like foreach(), applies the function of the second argument to each element of the table.

  • Usage is almost the same as foreach(), plus index values can be referenced within the function.
  • The specified table is returned. (TMAP() nested functions can be applied multiply)
  • The return value in the function specified in the argument can update each element of the table.
  • This function consumes 27 Token.
local t={
t=tmap(t, function(v,i)


t=tmap(t, function(v,i)
 return v


}, function(v,i)
 return v

may want to Use DMP() if check the converted table.
This function is included in the KNUTIL library.

P#77195 2022-03-21 08:51

Cart #combine_table-0 | 2022-03-15 | Code ▽ | Embed ▽ | No License

Feature Overview

COMB() combines two tables to create a hash table.

  • Returns the joined table.
  • The two arguments must be tables of index arrays.
  • The argument is nondestructive.
  • Hash tables are not in constant order. (This is a Lua specification.)
  • This function consumes 26 Token.
local keys={'name','species','home','skill'}
local values={'ruth','fox','port town','kon-psi'}

local charcter=comb(keys,values)

may want to Use DMP() if check the converted table.
This function is included in the KNUTIL library.

P#108664 2022-03-15 14:40

Cart #concat___table-0 | 2022-03-11 | Code ▽ | Embed ▽ | No License

Feature Overview

CAT() concatenates two or more tables.

  • The second and subsequent arguments are added to the table elements of the first argument.
  • Returns a concatenated table.
  • The table used for the first argument is updated. (destructive)
  • This function consumes 39 Token.
local tbl_1 = {'a'}
local tbl_2 = {'b', 'c'}

cat(tbl_1, tbl_2)


-- Only primary elements can be cloned.
local tbl = {1, 2, 3}
local tbl_dup = cat({}, tbl)
tbl[1] = 256


See the code in the cartridge for further examples.

may want to Use VDMP() if check the converted table.
This function is included in the KNUTIL library.

P#88288 2022-03-11 14:12 ( Edited 2022-03-21 09:09)


I want to use the clipboard to paste SFX data to another console as shown in the image below.
With the current (0.2.4b) function of PICO-8, you can only paste SFX data on the same console.
It would be simpler to share sound effects if they could be pasted to the clipboard in a format like
[gfx] wwhhpp... [/gfx)

P#107590 2022-02-27 15:26 ( Edited 2022-02-28 01:01)

In what situations do you use these conversions?

hexnumber = '3xz'

tonum(hexnumber,1)       : 768 (0x0300.0000)

tonum("0x"..hexnumber,4) : 0 (0x0000.0000)

tonum('0x'..hexnumber)   : -- NO VALUE --([nil])

I want "nil" to be returned when I use a character as an identifier. Therefore, I use the "C" conversion.

hexstr = '108000789$'
hexval = TONORM(hexstr) -- Normalize the value [number boolian nil], otherwise it remains a string.
hextable = {}

if type(hexval) == 'string' then

 foreach(split(hexstr, 3), function(v)
  add(hextable, tonum('0x' .. v))


-- Handle hexadecimal conversions without being converted to numbers by normalization.
-- Only the value of number is stored in the hextable.
-- "$" is not stored.
P#90457 2022-02-24 10:36

I noticed that split() splits the table at the first character if you use a separator of more than two characters.
Is it a bug or a specification that split() cannot be used with separators of more than two characters?

Thank you.

If there is no limit to the number of characters in the separator, string replacement can be implemented in a compact way. (as in replace_short())

function replace_short(s,f,r)
  return join(split(s,f),r or '')
-- join() is custom function

function replace(s,f,r)
 local a=''
 while #s>0 do
  local t=sub(s,1,#f)
  a=a..(t~=f and sub(s,1,1) or r or '')
  s=sub(s,t==f and 1+#f or 2)
 return a

P#107090 2022-02-17 13:37

Cart #knutil-1 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Feature Overview

"KNUTIL" is a library for PICO-8 that contains functions that are frequently used in the games I have created.
I've kept the functions that I eventually needed in my production.

In this cart, I show you how the scene functions work with animations.
Z key: Execute the order command.
Up/Down: Select the order command.

SCENE MANAGER controls and replaces the order in which functions are called with a small number of tokens by using consecutive string instructions.
The generated SCENE can register a global function as an ORDER.
One of the registered ORDERS is retrieved by SCENE and the process is repeated for the specified length.
When the processing is finished, it repeats the processing of the next ORDER.
This is expected to facilitate the planning of the performance.




SCENES: Contains the generated SCENEs.
INDEXES: The indexes needed to run the SCENES in the order they were generated.

Enter an ORDER into a SCENE ( CMDSCENES )

  • [SCENE NAME] : Specify the name generated by MKSCENES.
  • [COMMAND] : Specify the following ORDER COMMANDS.
  • [FUNCTION NAME] : Specify the name of the global function.
  • [DURATION FRAME]: Specifies the number of frames to be sustained; if set to 0, it will not automatically terminate.


ST (SET): Delete all stacked ORDERS in SCENE and set new ORDERS.


Clean the SCENE "UPD" and add a "FUNCTION MANAGE".

PS (PUSH): Add an ORDER to the SCENE


Add the SCENE "KEY" with "FUNCTION KEYCHECK" at the top.

US (UNSHIFT): interrupt ORDER at the beginning of a SCENE.


Scene "DRW" is executed in the ORDER of DRAWCIRC, NIL, DRAWRECT.

RM (REMOVE): remove one ORDER.


Removes the first ORDER of the SCENE "DRW".


Deletes the DRAWRECT ORDER of SCENE "DRW", starting from the top.

CL (CLEAR): Remove all stacked ORDERS from the SCENE.


Deletes all the ORDERS registered in the SCENE "KEY".

FI (FIND): Search and retrieve ORDERS from a SCENE.


In this case, the return value RES is a table, and the ORDER "DRAWRECT" is in the first element.

Create a function for ORDERS.


Run each SCENE.

## In the _UPDATE() and _DRAW() functions

ORDER function

        STOP"IT'S FIRST!"
        STOP"IT'S LAST!"

Properties of ORDER


ORDER.FST : at first execution
ORDER.LST : at the last execution.


ORDER.CNT : Execution count of the currently running ORDER.
ORDER.DUR : Count of expected end of the currently running ORDER.


It contains the value specified in the second argument of CMDSCENES.


Used to specify the end from the start, e.g. in coordinates.

ORDER.rate('[start] [end]', duration, count )

The default values for duration and count are the ones specified in CMDSCENES.

Force ORDER termination.

Do return 1
do ORDER.rm = 1.

Functions other than scenes

There is one in this library that I have already posted.

HTBL: Converting a string to a table(Multidimensional Array / Hash Table / Jagged Arrays)

Cart #stringhashtable-2 | 2022-03-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

DMP: Dumps information about a variable.

Cart #vdmplua-2 | 2022-03-30 | Code ▽ | Embed ▽ | No License

CAT: Concatenate tables. Indexes are added last and identical keys are overwritten.

Cart #concat___table-0 | 2022-03-11 | Code ▽ | Embed ▽ | No License

COMB: Combines two tables to create a hash table.

Cart #combine_table-0 | 2022-03-15 | Code ▽ | Embed ▽ | No License

TMAP: More compact operable foreach iterator.

Cart #tablemap-0 | 2022-03-21 | Code ▽ | Embed ▽ | No License

RCEACH: Iterate from rectangle values.

Cart #rceach-0 | 2022-03-30 | Code ▽ | Embed ▽ | No License

Functions not posted on BBS. (I will post them some other time)

TONORM: String to type conversion(boolian, nil, number).
TOHEX: Convert hexadecimal string without "0x".
TTOH: Sum the numbers in argument 1 by shifting bits to argument 2.
HTOT: Divide an integer value into 8 bits and make it into a table.
REPLACE: Perform string substitutions.
EXRECT(RFMT): Drawing and overlap judgment with the generated rectangle.
TOC: Divide the value and exclude the remainder.
JOIN: Convert a table containing strings into a single string.
SPLIT(wrapper function): Split() for two-dimensional support. Defaults to space separator.
HTD: Convert a hexadecimal string to a 4-bit-16-bit table.
SLICE: Cuts out the table at the specified index.
TBFILL: Creates a table filled with the specified values. (Two dimensional support)
OUTLINE: Display text with edges.
MKPAL: Create a table to be used in pal(), specifying the colors before and after the change.
ECMKPAL: Generate a set of tables to be retrieved by MKPAL().
ECPALT: Run palt() on the table.
TTABLE: If it is not a table, it returns FALSE, otherwise it returns as is.
INRNG: Judges that the value is within the range of two values.
AMID: Expand the arguments to positive and negative and do mid().
BMCH: Compares two values to judge that they both have a bit in common.


Mainly due to sub()'s CPU cost countermeasure.

  • replace: fix usage of sub()
  • htd: Convert from split()
  • htbl: Run newlines without replace()
  • scene: Save cost with split()&comb() at initialization
  • dbg: Change to display values without dbg() argument
  • example: Add htbl() example use
P#59538 2021-03-03 12:49 ( Edited 2022-03-30 11:21)

Hello, everyone.

A few days ago, a game I created called KONSAIRI was released on Steam!

There are still very few examples of PICO-8 games on the Steam platform as PICO-8 games.

I think that's because, as content, PICO8 titles are seen as lacking when compared to other game engines and those created in a free development environment with no restrictions.

But I challenge you to dream of being in the same store as a masterpiece game, despite its limitations.

I also wish to see more interest in PICO-8 in my part of Japan.


P#83569 2020-11-01 14:36


I would like the exported file to include the current config.txt (global_config.txt) as local_config.txt in the exported file.

This will allow us to play from the creator's ideal config in another user's environment.

"global_config.txt" refers to the config.txt that I've been using.
If both global_config.txt and local_config.txt exist, local_config.txt is assumed to take precedence.

Sequence of events

I recently released the PICO-8 app in executable format.
However, the user's environment that downloaded it had different operations and a lower frame rate for inactive windows.
The released manual had to be rewritten and the creator was unable to provide the ideal play environment.

A question thread containing this

P#83100 2020-10-19 03:47

Is there a recommended coding method that would eliminate the drop frames that occur when the pico8 window is turned to the back?
Or is there a memory address I can set?

I want to keep the number of times to execute _update60() and draw() the same, even at 30fps.

P#83056 2020-10-18 03:05

P#82463 2020-09-30 12:29

Before I knew it, I had made a lot of them...

P#82254 2020-09-25 08:54 ( Edited 2022-04-04 15:55)

I'm developing KONSAIRI, a game I've been working on for a while now that I'm finalizing and checking throughout the game.

As I mentioned before, the goal of the game is to move back and forth between 16 different areas to reach the final destination.

However, it seemed to feel like the same old thing before you even reach halfway through the game.

That's why i added Dungeon mode, which changes the look and feel of the adventure dramatically.

Not only do you take damage when you touch an enemy, but there are hidden passages and hints scattered throughout the game that will help you get to the true ending.

When you stand in front of an enemy, you will see a timing gauge.
It's not for attacking, but for getting through to the enemy's rear.
A well-timed "step move" will allow you to move forward with no damage.
If time passes, you will be damaged.
If you move away from the spot, you can avoid the danger.

You can bring in items, throw them and use skills.
You can open doors, read hints, light up and explore, and more...!



P#81477 2020-09-03 16:01 ( Edited 2020-09-03 16:06)

I think being able to scroll horizontally with "Shift + mouse wheel" would make it easier to check for longer lines.

I can also use line breaks to keep up appearances, but I don't want to add too many characters.

P#80878 2020-08-17 13:30

Current Development

I'm building a relationship between NPCs and area map connections.
These are mainly for the latter 8 areas.
(The "keys" that NPCs have might be easier to understand.)

This game has a combined total of 16 areas.
There are also useful items that will help you move through such a large world.
These items can be found at the end of the first half of the game.

Then, the image below shows the map of the first half of the game.

Reduced map for 8 areas

Most of the maps are over 128*128 cell size.
The aspect ratio varies from area to area and the structure is challenging to explore.
Once you get your "KUWAI", use it! You can look around the entire area.

Actual map display

An animated tile is provided in each area.
These tiles bring about the effect of the wind.
You can use "PERSNIP" to change the wind (flow).

Awaking bells

The status limit is relaxed when you earn a BELL.
When you earn bells, the status limit is relaxed.
Bells can be earned by eating with NPCs when your friendship is somewhat higher.

The higher your status, the less items you'll have to wear out or take time to move around.

The color of the BELL is the color of the POT

Acquiring a bell of the same color (material) will have no effect.
You may be able to get bells of a different color from a different NPC.
The color of the pot and the color of the bell are the same; check it when you help the NPC.

Updated KONSAIRI trial version!

The performance of the action part has been improved!
Download a playable file here.

Have fun in a small and wide world! ;)

P#80624 2020-08-13 02:27 ( Edited 2020-08-13 09:48)

Does the random value generation by srand() always produce the same pattern output as long as the same seed value is input?

Does the output pattern change due to a change in the environment?
For example, the upgrades, the amount of code, the timing of the exports, the machine or OS you're running...

So far I haven't been able to verify much and I haven't encountered the fact that the output results have changed, but I am concerned.

Thanks for your help.

P#79667 2020-07-20 12:55 ( Edited 2020-07-20 12:56)

I'm working on a big project for PICO8.

Around the end of 2018, I learned about the scalability of multi-carting and continued to research and create it to this day.

We were able to give each of the four carts a role, rather than just being a data bank .

Cart 1: Title/Ending/3D dungeon scene
Cart 2: Platformer Scene
Cart 3: Cooking Scene
Cart 4: World Map Scene/Important Item Riddle Solving Operation

Because of these many factors, an hour or more of play is a must.
Data saves are automatic.
(Position when resume, growth and LIFE, possessions, time, status of NPCs helped, farmland, important items, veggies, history of veggies removed, history of enemies removed, and other things for cart-to-cart interaction).

Most of the game system is complete. I'm currently assembling the map for the later areas.

If anyone is planning an original, reasonably large game, PICO8 will be used as a prototype. It looks like they will progress the production and do the actual product in another game engine. I've seen some of those opinions. (Not my project.)

So sometimes what I do seems like a waste of time or laziness in choosing a development environment.
I don't see a lot of things planned in PICO8 from start to finish. It's not much.
Is it because of the scarcity that I am still developing? I don't think that's the only reason.

I'm not great at asking questions and such. Still, I've been able to implement a lot of features in the game because people before me have been posting and discussing their work repeatedly. Thanks for leaving the information, very grateful to you.

(I think the English translation is unnatural because it is a long sentence.)


P#78871 2020-07-04 07:18 ( Edited 2020-09-27 13:43)

View Older Posts
Follow Lexaloffle:        
Generated 2022-05-20 14:59:29 | 0.067s | Q:59