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: 3de61daf53d7534db064988f205a4a51043601e1
Page Name:SQL functions
Date: 2018-08-18 01:19:28
Original User: zzo38
Parent: 858167968414b5d897ef769f588250470de6bd8c (diff)
Next f8ac2edececb8bca97bfd2549f2f43944fffdfb3
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).

CLASS_DATA(id,info)

Returns data about the class with the given ID number.

The second argument can be: 0=class ID number, 1=Temperature, 2=Shape, 7=first image number available in editor (null if none), 12=Misc4, 13=Misc5, 14=Misc6, 15=Misc7, 18=Arrivals, 19=Departures, 32=Busy, 33=Invisible, 34=UserSignal, 35=UserState, 36=KeyCleared, 37=Player, 38=Destroyed, 39=Stealthy, 40=VisualOnly, 64=Density, 65=Volume, 66=Strength, 67=Weight, 69=Height, 70=Climb, 72=Hard(E), 73=Hard(N), 74=Hard(W), 75=Hard(S), 76=Sharp(E), 77=Sharp(N), 78=Sharp(W), 79=Sharp(S), 80=Shape(E), 81=Shape(N), 82=Shape(W), 83=Shape(S), 84=Shovable, 128=fraction of volume, 129=number of user variables, 130=CollisionLayers, 132=Compatible

CVALUE(number)

Returns a 64-bit integer representing a value of type TY_CLASS; the argument is the class number.

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.

LOAD_LEVEL(levelid)

Load a level by ID; returns null. Usable only if the -x switch is used; otherwise it is an error.

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.

MVALUE(number)

Returns a 64-bit integer representing a value of type TY_MESSAGE; the argument is the message number.

NVALUE(number)

Returns a 64-bit integer representing a value of type TY_NUMBER; the argument is the number. This function is actually the same as ZERO_EXTEND.

OVALUE(number)

Returns a 64-bit integer representing a object pointer value; the argument is the object ID number.

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.

ZERO_EXTEND(num)

Zero-extend a 32-bit integer to 64-bits. Can also be used to convert other types of values (such as classes, messages, and objects) into plain numbers.