Free Hero Mesh

Update of "SQL functions"
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview

Artifact ID: d879781b149de39ecf6275dca7c9abfaf88b3868
Page Name:SQL functions
Date: 2018-06-15 23:41:59
Original User: anonymous
Parent: 45efdeb1c66cc18886f75ac373aa33dec345c997 (diff)
Next 5fd9b1cadadd18a4ac19b5da97e036ec94cdc83d
Content

This document is a list of the available SQL functions that you can use in the customization of Free Hero Mesh. In addition to the ones listed here, you can also use the core functions, date/time functions, and aggregate functions, of SQLite, as well as any functions defined by extensions. See also: SQL tables.

(Note: This is only a draft and is likely to change in future.)

Asterisks in the headings indicate aggregate functions.

BASENAME()

Returns the base name, which is a copy of the first command-line argument (other than switches).

LEVEL()

Returns the one-based order number of the current level.

LEVEL_CACHEID()

Returns the ID number of the active level file in the user cache table.

LEVEL_ID()

Returns the ID number of the current level.

MODSTATE()

Get the current keyboard modifiers state. It is the sum of the following:

MOVENUMBER()

Tells you how many moves have been played so far since it has been reset.

PICTURE_SIZE()

Tell you the picture size.

READ_LUMP_AT(offset,ptr)

Used internally by Free Hero Mesh. If the second argument is not a pointer to a FILE, this function does nothing. Since SQL codes cannot generate pointers, there is no way to use this in user code.

RESOURCE(...)

Given a list of strings, find the matching resource from the .heromeshrc file and command-line arguments. Result is null if there is no such resource value.

SIGN_EXTEND(num)

Sign-extend a 32-bit integer to 64-bits. The 32-bit user variables in Free Hero Mesh might or might not be signed, so when accessing them in SQL (which uses 64-bit numbers) you must use this if you want to treat it as a signed number.

SOLUTION_CACHEID()

Returns the ID number of the active level file in the user cache table.

SOLUTION_REPLAY()

Returns 1 if replaying the solution or 0 for the normal game.