list of numbers

From Wiki

Jump to: navigation, search

Numbers are a means to add some programmatic functionality to Sword of Moonlight via calculator like mathematical expressions. Numbers are typically setup inside of an Ex.ini file. This list contains built in and so-called system numbers only.

Sword of Moonlight

Variables

c

pc

npc

Constants

List of

Legend
SOM_SYS settings part of SOM_SYS (SOM_SYS.exe) usually kept in the Sys.dat file.
m/s the constant's units are meters per second.
c/s the constant's units are radians per second.
Note that constants based on figures originally in degrees are converted to radians.
_WALK (SOM_SYS; m/s)
the player character walking speed.
_DASH (SOM_SYS; m/s)
the player character dashing speed.
_TURN (SOM_SYS; c/s)
the player character turning speed.

Serialization

It is possible to write a series of numbers. Care must be taken to not do so accidentally. The following table demonstrates the rules that must be observed. However the basic rules are pretty simple. If a mathematical operator has a space on one side, then it must have a space on its other side, and vice versa. In other words, 1 + 2 or 1+2. If a positive (+) or negative (-) sign appears in front of a number it must be flush with the number, or -1, not - 1. There are no operators that appear behind numbers.

input produces output
1 2 => 1, 2
2 +3 => 2, 3
3 + 4 => 3+4
4 + -5 => 4-5
input produces output
5 +-6 => 5, -6
-6+7 => -6+7
-7--8 => -7+8
-8 --9 => -8, 9


If you experience different results then that is a software bug that should not be relied upon in order to ensure you expressions continue to work correctly in the future.

Tip: where there is no empty space an expression cannot be interpreted as a series. 2(X) is 2*X, (X)(Y) is X*Y, and Y(2)X is X[Y(2)] and 2XY is XY[2]. This all works because plain numbers when written as a function behave as if multiplied. The rest is explained by #subscripts.

Space and separators

Spacing characters include space ( ), tab, carriage-return, new-line, and any other character that produces empty space wherever it appears. Note that tab and other kinds of characters sometimes appear as zero width spaces. This can be a nuisance as they will nonetheless be interpreted as space.

End of the line characters (carriage-return and new-line) are ignored along with any spacing characters that follow. When working with multiple lines care must be taken to observe spacing rules precisely. When a series is spread over multiple lines an explicit separator (#,;) should be placed between the last element on the line and the first element on the next line. A semicolon (;) at the end of the line is recommended for this.

Like with HTML (except for following the end of a line where empty space is ignored) one space, or two spaces, or any number of spacing characters (and or separators) is collapsed into a single space for purposes of serialization.

,;

The colon (,) and semicolon (;) are reserved separators. They are strictly equivalent to a space ( ) character, except you can see them as written. In other words 1 2 or 1,2 or 1;2 it doesn't matter. If necessary more separators can be added or an extension can be provided to allow for the definition of custom separators.

Note that separators are simply filtered out. So if you write 1,+,2 this is equivalent to 1+2. Care should still be taken to observe the rules of serialization and cautions about working with multiple lines in the previous section.

Subscripts and labels

[]

Mathematics

Calculations

Arithmetic

()

||

Enclosing an expression within two vertical bars (|) yields its absolute value. For example, |-7| makes 7. But you must beware that nesting without parentheses (#()) is not supported. Something like |c[|A|]| also works where square brackets are able to be used in place of parentheses.

In other words: |(|A|-|B|)| does work. While ||A|-|B|| does not work. Alternatively consider #abs(|A|-|B|).

abs

Decision trees

?:

if

Logical operations

_E

and

nand

or

nor

xor

xnor

Complex numbers

x

y

iy

Identity coalescence and inequality

nan

inf

not

neg

Reflection and recursion

_

_S

_$

_N

Statistical analysis

n

int

mod

min

max

r

Transcendental functions

^

cos

exp

log

pow

sin

tan