This page contains a reference of all predefined input/output variables, constants, operators, and functions you can use when writing a script to process your pen/mouse data with **Lazy Nezumi Pro**.

- Output Variables
- Input Variables
- Constants
- Operators
- Functions
- L-System Functions
- Scripting Engine Version History

Your script must assign a value to at least one of these output variables for it to have an effect.

Name | Description | Range/Units |
---|---|---|

ox | Pen x coordinate. | Screen pixels |

oy | Pen y coordinate. | Screen pixels |

op | Pen pressure. | Normalized [0..1] |

or | Pen rotation. | Normalized [0..1] |

ote | Pen tilt elevation. | [0..1024] |

ota | Pen tilt angle. | Normalized [0..1] |

These variables are updated before your script is called. They give your script a way to use your pen/mouse data.

Name | Description | Range/Units |
---|---|---|

x | Pen x coordinate. | Screen pixels |

y | Pen y coordinate. | Screen pixels |

rx | Pen x coordinate before ruler stage. | Screen pixels |

ry | Pen y coordinate before ruler stage. | Screen pixels |

sx | Start of stroke x coordinate. | Screen pixels |

sy | Start of stroke y coordinate. | Screen pixels |

ex | End of previous stroke x coordinate. | Screen pixels |

ey | End of previous stroke y coordinate. | Screen pixels |

psx | Start of previous stroke x coordinate. | Screen pixels |

psy | Start of previous stroke y coordinate. | Screen pixels |

p | Pen pressure. | Normalized [0..1] |

d | Distance from start of current stroke. | Screen pixels |

dn | For rulers with a center or connection point: normalized distance. | Radial/Perspective/Connected: 1.0 at start, 0.0 at center/VP/connection point. Ellipse: 0.0 at start, plus or minus 1.0 for each time around. |

ds | Rulers: Radial, Perspective, Connected Distance from start to center/VP/connection point. | Screen pixels |

s | Pen speed. | Screen pixels between updates |

ew | Ellipse ruler width (width >= height). | Screen pixels |

eh | Ellipse ruler height. | Screen pixels |

er | Ellipse ruler rotation. | Degrees |

eca | Ellipse ruler current angle of pen position. | Degrees |

nx | Line normal x coordinate. | [-1..1] |

ny | Line normal y coordinate. | [-1..1] |

dx | Change in x since last pen position. | Screen pixels |

dy | Change in y since last pen position. | Screen pixels |

rcx | Ruler center position x. | Screen pixels |

rcy | Ruler center position y. | Screen pixels |

r | Pen rotation. | Normalized [0..1] |

te | Pen tilt elevation. | [0..1024] |

ta | Pen tilt angle. | Normalized [0..1] |

res0 | Result 0 of special functions. | Function dependant |

res1 | Result 1 of special functions. | Function dependant |

These are useful mathematical constants you can use in your scripts instead of writing out their values.

Name | Description | Value |
---|---|---|

pi | Archimedes' constant π. | 3.1415926536 |

e | Euler's number e. | 2.7182818284 |

phi | The golden ratio φ. | 1.6180339887 |

inf | A very big value. | 3.402823466e+38F |

These are the scripting language operators, and their priority in a statement when not using parentheses.

Operator | Description | Priority |
---|---|---|

= | Assign a value to a variable. | -1 |

condition ? a : b | Evaluates to a if condition is true, b otherwise. | 0 |

&& | Boolean AND. | 1 |

|| | Boolean OR. | 2 |

<= | Less or equal. | 4 |

>= | Greater or equal. | 4 |

!= | Not equal. | 4 |

== | Equal. | 4 |

< | Less than. | 4 |

> | Greater than. | 4 |

+ | Add. | 5 |

- | Subtract. | 5 |

* | Multiply. | 6 |

/ | Divide. | 6 |

^ | Exponentiate. | 7 |

These are all the functions your script can call. When available, click the links to see graph previews.

Wave Functions | Description |
---|---|

saw(x) | Saw wave. All wave functions output in range [-1..1], and have a period of 1. graph |

sine(x, thickness) | Sine wave. Thickness parameter [0..1] controls how thick the crests are. Set to 1 for regular sine wave. graph |

triangle(x) | Triangle wave. graph |

square(x, pulseWidth) | Square wave. PulseWidth parameter [-1..1] controls width of crest. Set to 0 for a symmetrical wave. graph |

sigmoid(x) | Sigmoid wave. graph |

noise(x) | Sine-like noise function (continuous). graph |

cellNoise(x) | Square-like noise function (non-continuous). graph |

Trigonometric Functions | Description |

sin(a), cos(a), tan(a) | Sine, Cosine, Tangent of angle a (in radians). graph |

asin(x), acos(x), atan(x) | Inverse Sine, Cosine, Tangent functions (returns radians). graph |

Hyperbolic Functions | Description |

sinh(x), cosh(x), tanh(x) | Hyperbolic Sine, Cosine, Tangent functions. graph |

asinh(x), acosh(x), atanh(x) | Inverse Hyperbolic Sine, Cosine, Tangent functions. graph |

Exponential Functions | Description |

log2(x) | Binary (base 2) logarithm of x. graph |

log10(x) | Decimal (base 10) logarithm of x. graph |

log(x), ln(x) | Natural (base e) logarithm of x. graph |

exp(x) | e raised to the x power. graph |

sqrt(x) | Square root of x. graph |

rsqrt(x) | Inverse square root of x. graph |

Float Operations | Description |

abs(x) | Absolute value of x. |

sign(x) | -1 if x < 0, 1 if x > 0, 0 if x == 0. |

rint(x) | Round to closest integral value. graph |

ceil(x) | Round up to the closest integral value. graph |

floor(x) | Round down to the closest integral value. graph |

frac(x) | Fractional part of x. graph |

fmod(x, y) | Floating-point remainder of x/y. |

clamp(a, b, x) | Clamp x to range [a..b]. graph |

mix(a, b, w) | Returns a when w is 0, b when w is 1, linear interpolation in between. graph |

smoothStep(a, b, x) | Returns 0 if x < a, 1 if x > b, cubic interpolation in between. graph |

smootherStep(a, b, x) | Like smoothStep but with quintic polynomial interpolation. graph |

Random Value Functions | Description |

rand() | Random value in range [0..1]. |

srand() | Random value in range [-1..1]. |

randGauss(mean, stddev) | Random value using gaussian distribution using supplied mean and standard deviation. |

Vector Functions | Description |

atan2(y, x) | Angle of (x, y) vector, in radians. |

normalize(x, y) | Returns length of (x, y) vector and normalizes it into (res0, res1). |

length(x, y) | Length of (x, y) vector. |

rlength(x, y) | Inverse length of (x, y) vector. |

lengthSq(x, y) | Square length of (x, y) vector. |

rotDeg(x, y, a) | Rotate (x, y) vector a degrees into (res0, res1). |

rotRad(x, y, a) | Rotate (x, y) vector a radians into (res0, res1). |

getQuadraticTangent(x, y, a) | Returns a normalized vector (res0, res1) that is tangent to the quadratic curve y = a * x^2, that passes through point (x, y). |

Statistics Functions | Description |

sum(...) | Sum of all arguments. |

avg(...) | Average of all arguments. |

min(...) | Minimum value of all arguments. |

max(...) | Maximum value of all arguments. |

Debugging & Logging | Description |

debugOut1(string, value) | Send string in printf format (with one argument) to the log (use dbgview app to see output). Example: debugOut1("Var: %f", var); |

debugOut2(string, v1, v2) | Send string in printf format (with two arguments) to the log. Example: debugOut2("Var1: %f, Var2: %f", var1, var2); |

These are all the available **L-System** related functions that you can use in your scripts for generative art.

Function | Description |
---|---|

lsysAxiom(string) | Set the Axiom (starting state) of the system. |

lsysRules(string) | Set the Rules of the system, in the following format: [symbol]=[symbols],[symbol]=[symbols],... |

lsysIterations(number) | Set the number of times the system should be iterated before producing the final instruction string. |

lsysDrawSymbols(string) | Set the symbols (one after the other, without spaces or commas) that will cause the pen to move when encountered in the final instruction string. Other symbols will only be used to control the evolution of the system as it is iterated. |

lsysDir(x, y) | Set the pen's starting Direction vector. Default is (1, 0). |

lsysAngle(angle) | Set the starting Angle (in degrees) that will be used when processing a rotate (+ or -) instruction. Default is 90. |

lsysAngleRandom(angle) | Set the maximum angle (in degrees) that can be randomly added to the current Angle when processing a rotate instruction. Default is 0. |

lsysAngleScale(factor) | Set the Angle Scale Factor. Default is 1.2. |

lsysAngleInc(inc) | Set the Angle Increase Factor. Default is 5. |

lsysThickness(thick) | Set the starting line Thickness, between 0.0 and 1.0. Default is 1.0. |

lsysThicknessRandom(factor) | Set the percentage of current Thickness that can be randomly added when moving the pen position. Default is 0. |

lsysThicknessScale(factor) | Set the Thickness Scale Factor. Default is 2.0. |

lsysThicknessInc(inc) | Set the Thickness Increase Factor. Default is 0.1. |

lsysLength(len) | Set the starting line Length. Default is 1.0. |

lsysLengthRandom(factor) | Set the percentage of current Length that can be randomly added when moving the pen position. Default is 0. |

lsysLengthScale(factor) | Set the Length Scale Factor. Default is 1.3. |

lsysLengthInc(inc) | Set the Length Increase Factor. Default is 0.1. |

lsysLoop(loop) | If loop is 1, then lsysAdvance will wrap around to the start of the system's instruction string upon reaching the end. Otherwise, the pen position will no longer be updated. Default is 0. |

lsysAdvance() | Step through the system's instruction string until finding a Draw Symbol, at which point the pen's position is moved by the current Length in the current Direction. The new position is stored in the ox, oy variables, and the current thickness is stored in the op variable. |

The following table describes the function of each **Symbol** you can use when defining your **L-System Axiom and Rules**.

Symbol | Instruction |
---|---|

Any Draw Symbol | Move the pen position by Length amount in the current Direction. |

0-9 | Sets the current Skip Number (used with the ? symbol). |

? | Random Skip: Draw a random number between 0 and 10. If it is higher than the current Skip Number, then skip the next instruction. |

: | Skip the next instruction. You can use this to write statements like 5?A:B, where either A or B will be executed. |

( ) | Open and close an Instruction Group. This lets you skip an entire group of instructions by writing something like 5?(AB):(CD). |

+ | Rotate the current Direction left by the set Angle amount, plus a random amount of which the maximum is set by lsysAngleRandom. |

- | Rotate the current Direction right by the set Angle amount, plus a random amount of which the maximum is set by lsysAngleRandom. |

| | Reverse direction (rotate 180 degrees). |

. | Exchange meaning of + and -. |

! | Divide Thickness by Thickness Scale Factor. |

@ | Multiply Thickness by Thickness Scale Factor. |

# | Decrease Thickness by Thickness Increase Factor. |

$ | Increase Thickness by Thickness Increase Factor. |

% | Divide Length by Length Scale Factor. |

^ | Multiply Length by Length Scale Factor. |

& | Decrease Length by Length Increase Factor times Start Length. |

* | Increase Length by Length Increase Factor times Start Length. |

{ | Divide Angle by Angle Scale Factor. |

} | Multiply Angle by Angle Scale Factor. |

< | Decrease Angle by Angle Increase Factor. |

> | Increase Angle by Angle Increase Factor. |

[ | Save the state and start a new Branch. |

] | End the current Branch and restore the state. |

Depending on the version of **Lazy Nezumi Pro** you are using, you may not be able to use all the scripting functionalities shown on this page. This section shows the version history.

**21.06.05** New functions: noise, cellNoise, sine, saw, triangle, square, sigmoid, debugOut2. New constant: phi. Added /* */ and // style comment support.

**18.02.01** New input variables: ew, er, eca.

**17.06.09** New input variable: ds.

**17.03.25** New input variables: rcx, rcy.

**17.01.25** New input variables: rx, ry.

**16.11.13** New input variables: dn, eh.

**15.05.05** New input variables: psx, psy.

**14.08.26** New function: getQuadraticTangent.

**14.08.09** New constant: inf.

**14.06.17** New input variables: ex, ey.

**14.05.06** New functions: normalize, length, rlength, lengthSq. New input variables: dx, dy.

**14.04.14** L-System functions.

**14.03.27** New functions: clamp, debugOut, rotDeg, rotRad.

**14.03.17** Scripting engine introduced.

Copyright © 2013-2021 Guillaume Stordeur. All rights reserved. Privacy Policy. EULA.

Lazy Nezumi is a trademark of Guillaume Stordeur. Adobe, Photoshop and Flash are trademarks of Adobe Systems Inc. Windows is a trademark of Microsoft Corp.