Table of contents |
{} | Code block. |
' ' | Literal; substitutes a character for its integer value. |
"" | Constant string. Strings are concatenated where possible. |
() | Parenthesis. |
[] | Array indices. |
. | The dot is used for referencing elements in a structure. |
, | The comma separates function parameters. Used outside of function parenthesis, it is a sequential evaluation operator (i.e. "i=(g=sqrt(f),g+1);" means "g=sqrt(f); i=g+1;"). |
! | Logical not; '!x' means 'x==0'. |
++ -- | Increment and decrement; '++x' will increment before value is used, 'x++' will increment after value is used. |
^ | Power; 'x^y' means calculate 'x' to the power of 'y'. |
* / | Multiply. Divide. |
% | Modulus; 'x % y' means calculate remainder of 'x' after division by 'y'. With the '%' operator, the result is always positive ('fmod(x,y)+|y|' for 'fmod(x,y)<0'). |
+ - | Add. Subtract. |
< <= > >= | Less than. Less than or equal to. Greater than. Greater than or equal to. |
== != | Equal to. Not equal to. |
&& | Logical and; 'x && y' is '1' if both values are non-zero. |
|| | Logical or; 'x || y' is '1' if either value is non-zero. |
^= %= *= /= += -= | Assignment with calculation. Uses the left hand side as the destination for the calculated value. |
= | Direct assignment to left hand side. |
auto | Defines a variable with local extent, using the stack. This is the default. Single variables are implicitly defined on their first use, but arrays must always be explicitly defined. |
break | Exits the loop it is used in. |
continue | Continues with the loop it is used in, skipping the code remaining. |
do | Standard implementation of a 'do' loop. |
double | Used to define a variable as a double precision floating point number. This is the default type (and currently the only internal type), and may be omitted. |
else | Used with 'if'; specifies a block of code to execute if the condition at 'if' is false. |
enum | Can define any constant value, and definitions lacking an explicit assignment have the value of the previous constant plus one. |
for | Standard implementation of a 'for' loop. |
goto | Continues execution at the specified label. |
if | Executes the following block of code if the specified condition is true. |
return | Ends a function and returns to the caller, with an optional value. Zero is used if no value is supplied. |
static | Defines a variable with static extent; it is initialized at compile time, and values are retained in the data section of the script. Can be used globally or locally. |
struct | Used to define a structure, which can be used as a type prefix for variables. |
while | Standard implementation of a 'while' loop. |
abs | Alias for 'fabs'. Provided for compatibility. |
acos | Calculates the inverse of a cosine. |
asin | Calculates the inverse of a sine. |
atan | Calculates the inverse of a tangent. |
atan2 | Same as 'atan', but with two parameters forming the ratio. |
ceil | Rounds to the lowest integer not less than the number. |
cos | Calculates the cosine. |
exp | Calculates 'e^x'. |
fabs | Calculates the absolute value; |x|. |
fact | Calculates the factorial. (Ken's function; fact(x) = gamma(x+1)) |
fadd | Forces addition without interference from the optimizer. (Allows fast quantization tricks like: fadd(x,3*2^51)-3*2^51) |
fdiv | Family of 'fadd'. |
floor | Rounds to the highest integer not more than the number. |
fmod | Calculates the floating point remainder; like '%', but can give a negative result if either parameter is negative. |
fmul | Family of 'fadd'. |
fsub | Family of 'fadd'. |
int | Rounds the number towards zero. |
log | Calculates the logarithm base 'e'. An optional second parameter form can be used to specify the base. |
log2 | Calculates the logarithm base 2. |
max | Calculates the greater of two numbers. |
min | Calculates the smaller of two numbers. |
near | Rounds the number towards the nearest integer. |
noise | Continuous noise function; can have one to three parameters. Original algorithm by Ken Perlin, implemented by Tom Dobrowolski, then further optimized for speed. |
nrnd | Returns a normal random number (avg:0, std:1). Can be used as a variable. |
pow | Function version of the '^' operator. |
rgb | Calculates: 'clamp_int(r)*2^16 + clamp_int(g)*2^8 + clamp_int(b)'. |
rnd | Returns a uniform random number in range: 0<=x<1. Can be used as a variable. |
sgn | Returns the sign of a number. A two parameter form can be used, where the value is compared to the second parameter instead of zero. Returns -1 for numbers less than zero, 0 for equal to zero, 1 for more than zero. |
sin | Calculates the sine. |
sqrt | Calculates the square root of a number. |
srand | Provides a seed for 'rnd', 'nrnd' and 'noise'. |
tan | Calculates the tangent. |
unit | See 'sgn'. Returns: 0 for negative, .5 for zero, 1 for positive. |
() static a[4] = {"A","B","C","D"}; static fmt = "Random: %s"; if (mousx > 500) { fmt = "Hey!"; } cls(0); printf(fmt, a[rnd * 4]); refresh(); sleep(1000);
Nov 2020 |
Return of the King: After 10 years, the compiler has finally received its long-awaited update. Many accumulated bug reports were dusted off and actually read for a change, and their corresponding fixes were implemented. The foundation for better string support was also added. See the syntax reference page for more details on new features. |
Feb 2010 |
Fixed a few crash bugs, as well as an internal corruption bug. Some modification was also done to increase the robustness of type checking. Implicit type casting is done when the source and destination fields both have the same size, otherwise a "Type mismatch" error is generated. |
Jan 2010 |
First public release! Featuring integration with Ken Silverman's Evaldraw, and a fair amount of compatibility with existing Evaldraw scripts. Bug reports and feature suggestions are welcome. My email address is on the index page. |