Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
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.
Using SCENE
Create a SCENE ( MKSCENES )
SCENES: Contains the generated SCENEs.
Enter an ORDER into a SCENE ( SCMD )
[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.
Only "tab characters" are supported for indentation in command descriptions.
ORDER COMMANDS
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.
ORDER function
Properties of ORDER
The following parameters can be referenced as global variables.
_FST / _LST
_FST : at first execution
_LST : at the last execution.
CNT / _DUR
_CNT : Execution count of the currently running ORDER.
_DUR : Count of expected end of the currently running ORDER.
_PRM
It contains the value specified in the second argument of SCMD.
_RATE
Used to specify the end from the start, e.g. in coordinates.
The default values for duration and count are the ones specified in SCMD.
Force ORDER termination.
Do RETURN 1
or
do _RM = 1
.
Functions other than scenes
SET 1: Basic Library
★ Libraries for frequent use and quick implementation
AMID : Expand the arguments to positive and negative and do mid().
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
BPACK : Pack the value of the bit specification with bit width.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
BUNPACK : Slice the value with bit width.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
CAT : Concatenate tables. Indexes are added last and identical keys are overwritten.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
COMB : Combines two tables to create a hash table.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
ECPALT : Set transparency from palette table.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
HTD : Split a continuous string of hexadecimal numbers into a table.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
HTBL : Converting a string to a table(Multidimensional Array / Hash Table / Jagged Arrays)
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
INRNG : Tests that the specified value is within a range.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
JOIN : Joins strings with a delimiter.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
MKPAL : create a color swap table for use in PAL()
.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
MSPLIT : Multi-layer split.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
OPRINT : Print with outline.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
RCEACH : Iterate from rectangle values.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
REPLACE : Perform string substitutions.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
TBFILL : Creates a table filled with the specified values.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
TMAP : More compact operable foreach iterator.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
TOHEX : Digit-aligned hexadecimal conversion (not including 0x).
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
TTABLE : If the argument is a table, the table is returned.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
SET 2: Libraries to create objects
★ Rectangles that incorporate judgment and drawing, scenes that manage screen and operation transitions
EXRECT : Creates a rectangle object with extended functionality.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
MKSCENES : This post! Manage screen and operation switching.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
SET 3: Debugging Library
★ Real-time or stop and inspect at any timing
DBG : Displays any timing debugging value.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
DMP : Dumps information about a variable.
Copy and paste the snippet below into your HTML.
Note: This cartridge's settings do not allow embedded playback. A [Play at lexaloffle] link will be included instead.
++ REMOVED ++
TOC : flr(divide) can be substituted for
\
.
ECMKPAL : The format was changed and integrated in MKPAL.
OUTLINE : Renamed to
OPRINT , will be reflected in v0.14 knutil.
SPLIT : Renamed to
MSPLIT , will be reflected in v0.14 knutil.
TTOH : Sum the numbers in argument 1 by shifting bits to argument 2.
This function has been re-specified to BPACK.
HTOT : Divide an integer value into 8 bits and make it into a table.
This function has been re-specified to BUNPACK.
SLICE : Cuts out the table at the specified index.
the function was removed because there is a {unpack()} with a similar function.
BMCH :
Compares two values to judge that they both have a bit in common. "Bitwise operators" make it less significant.
TONORM : Normalize argument values to the correct type(boolian, nil, number).
UPDATE HISTORY
v0.14.0
v0.13.1
corrected commented out vdmp to dmp.
v0.13
scene:
cmdscenes:supports indentation description by tabs.
v0.12
library help added to pause menu.
bmch: unlisted.
exrect: fix variable and function names.
scene:
rate: adjustment of decimal point overflow countermeasures.
cmdscenes: continuous call handling.
added functions for iterators.
dbg: simplification by join.
replace: support for multiple replacements.
v0.11
htd: fixed table values to local variables
bpack: specification change from ttoh()
bunpack: specification change from htot()
slice: the function was removed because there is a {unpack()} with a similar function.
v0.10
split: supports multi-dimensional arrays
cmdscenes: fixed for split update
sceneorder: update for use of tuples
dmp: apply p8scii font color
v0.9
tbfill: changed to specify indexes at the beginning and end of tables, support for variable length arguments.
tohex: fixed for update of tbfill()
v0.8
join: use of tuples
tbfill: defaults to 1 or specifies the start of the table
tohex: support for updating join()
v0.7
sceneorder:"rate" func countermeasures against overflow of digits
code update saved token:
htbl: 7 tokens
tonorm: 9 tokens
v0.6
simplified handling of scene orders
rceach: name change from ecxy()
inrng: using tupple twice
exrect.con: name change from exrect.cont()
exrect.hov: name change from exrect.hover()
scenes: order.rate is calculated enough value in the last count
cmdscenes: change name from scenesbat
v0.5
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
Please do not use this library and its code for the purpose of promoting vaccines.