Reference: Pack Code


This page is a details the pack code file format. In most cases, the average user should ignore all this. It is only for reference, and for those that decide to create or edit pack files for use with this app.

To share a puzzle pack, you have three options:

  • Share the text (pack code) which will build the pack.
  • Share a link to a the pack code file (You will need a publish it somewhere on the internet).
  • Add a deep link of the form keuwl://puzzle?url=https://www.keuwl.com/puzzles/testpack.txt but with a link to your pack instead. If the user has the app installed, then it will open it and request download of the pack.

Any puzzle packs you download may contain unsuitable images or copyrighted images. Only download from a trusted source. If creating pack code, it is recommended to only use suitable images you own the rights to and share though your own influencer channels since there is no option for sharing puzzle images from within the app itself.

Pack code files are saved as text, made up of descriptive functions that when combined in the right order, will build a puzzle pack. The pack code files can be opened and modified in any text editor.

An example of pack code is shown below:

pack_version(1);
pack_name("Test Pack")
pack_image("https://www.keuwl.com/puzzles/test_pack_image.jpg")
pack_extra()

new_puzzle()
image("https://www.keuwl.com/puzzles/test_image1.jpg");
name(Altiplano Rabbit)
extra(Mountain Viscacha)
seed(12345)
background_color(#BBAA44)
outline_color(#555)

new_puzzle(Dingo,"Fraser Island", "https://www.keuwl.com/puzzles/test_image2.jpg",#443,#bcab54,81234)



Typically in each file, there are a few pack commands that describe the pack, followed by descriptions of each of the puzzles to be added to the pack in order.

The pack commands are recommended, but not required and can be located anywhere within the pack code.

Each puzzle starts with a new_puzzle() command. Subsequent puzzle commands will all apply to that puzzle until another new_puzzle() command is reached.

If multiple commands of the same are applied to a puzzle, then earlier ones will be overwritten, such that only the last one will apply.


Syntax

• The commands are lower case with underscores separating the words.
• The end of a command is determined with a ; character or newline.
• Arguments/parameters of each command are contained within brackets () and are comma separated.
• Strings are enclosed in quotes "", although not strictly necessary.
• A Double slash outside of the brackets is used for comments. Anything after // on a line is ignored.


If a command has errors, they are reported on screen and the command ignored. Note that recent errors can also be viewed by going to the main settings and tapping the Recent Error/Other Messages button.


List of Commands

Following is a list of the commands used in a pack code file.

Pack Commands:

To create a puzzle, use:

Commands that apply to the current puzzle:

If a parameter for a command is shown to be enclosed in square brackets [] in the reference below, that parameter is optional.


pack_name(Name)

First appeared in App version 1.0

A String containing the name of the puzzle. Optionally enclosed in quotes “”. Use \" for quote character. Max length is 128 characters.


pack_extra(Extra)

First appeared in App version 1.0

After the pack name, this extra string is shown in the app. It could for example contain who the pack is created by. Optionally enclosed in quotes “”. Use \" for quote character. Max length is 128 characters.


pack_image(Source)

First appeared in App version 1.0

Link to the image on the internet. Optional. This is a small image showcasing the contents of the pack to make it easier to find from the pack selection screen.


pack_version(Extra)

First appeared in App version 1.0

A version number for the pack. A simple integer which is recommended to be incremented each time the pack is changed. This is optional. If the pack is already installed with the same or higher version number, a dialog typically appears warning user if they are sure they want to overwrite it.


new_puzzle() or new_puzzle(Name,Extra,Source[,Background Color[,Outline Color[,Seed]]])

First appeared in App version 1.0

Initiates creation of a new puzzle. The new puzzle contents can be added with multiple commands in the following lines, or bundled together in the brackets as indicated.

Name - A String containing the name of the puzzle. Optionally enclosed in quotes “”. Use \" for quote character. Max length is 150 characters.

Extra - More text to go alongside the name of the puzzle. Optionally enclosed in quotes “”. Use \" for quote character. Max length is 150 characters.

Source - Web Address of the image to use for the puzzle.

Background Color - An HTML colour, it is optionally enclosed inside quotes. It can be the six digit code, or the three digit code, thus #F82, #FF8822, “#F82” and “#FF8822” are all variants of entering the same color, in this case 0xFF (255 decimal) of red, 0x88 (136 decimal) of green, and 0x22 (34 decimal) of blue, which makes an orange color.

Outline Color - An HTML colour for the piece outline, it is optionally enclosed inside quotes. It can be the six digit code, or the three digit code,

Seed - Seed is an integer between 0 and 100000000 inclusive. Each seed will generate a puzzle with different piece shapes.



name(Name)

First appeared in App version 1.0

A String containing the name of the puzzle. Optionally enclosed in quotes “”. Use \" for quote character. Max length is 128 characters.


extra(Extra)

First appeared in App version 1.0

After the puzzle name, this extra string is shown in the app normally on the line below. It could for example contain who the puzzle is created by. Optionally enclosed in quotes “”. Use \" for quote character. Max length is 128 characters.


image(Source)

First appeared in App version 1.0

Full web address to the image on the internet. When the app downloads the pack, it will try to download this image from the internet. If it fails to find & download the image, it will just show a missing image picture instead.


seed(Seed)

First appeared in App version 1.0

Seed is an integer between 0 and 100000000 inclusive. Each seed will generate a puzzle with different piece shapes.


background_color(Color) or background_color(R,G,B)

First appeared in App version 1.0

This sets a 24-bit RGB color for the puzzle background.

You can enter an HTML color, or use three separate R, G, B Values.

When the background is a HTML colour, it is optionally enclosed inside quotes. It can be the six digit code, or the three digit code, thus #F82, #FF8822, “#F82” and “#FF8822” are all variants of entering the same color, in this case 0xFF (255 decimal) of red, 0x88 (136 decimal) of green, and 0x22 (34 decimal) of blue, which makes an orange color.

If setting a custom color for the puzzle to help choose a suitable color, the html code is shown in the edit color dialog. Tap on it to copy that value to the clipboard.

When entering the RGB values separately...

R is an integer in the range 0 to 255 corresponding to the amount of red in the colour.

G is an integer in the range 0 to 255 corresponding to the amount of green in the colour.

B is an integer in the range 0 to 255 corresponding to the amount of blue in the colour.


outline_color(Color) or outline_color(R,G,B)

First appeared in App version 1.0

This sets a 24-bit RGB color for the piece outline.

You can enter an HTML color, or use three separate R, G, B Values.

When the piece outline is a HTML colour, it is optionally enclosed inside quotes. It can be the six digit code, or the three digit code.

When entering the RGB values separately...

R is an integer in the range 0 to 255 corresponding to the amount of red in the colour.

G is an integer in the range 0 to 255 corresponding to the amount of green in the colour.

B is an integer in the range 0 to 255 corresponding to the amount of blue in the colour.