- chunk
- image
- model
- noisemap
- procedures_class
- random
- script_brush
- script_brush_event
- selection
- tag
- tex
- vector_3d
- vert
- abs
- acos
- acosh
- add_m2
- add_wmo
- append_file
- asin
- asinh
- atan
- atanh
- brush
- cam_pitch
- cam_yaw
- camera_pos
- cbrt
- ceil
- cos
- cosh
- create_image
- dist_2d
- dist_2d_compare
- exp
- floor
- get_area_id
- get_chunk
- get_map_id
- holding_alt
- holding_ctrl
- holding_left_mouse
- holding_right_mouse
- holding_shift
- holding_space
- lerp
- load_png
- log
- log10
- make_noise
- path_exists
- pow
- random_from_seed
- random_from_time
- read_file
- rotate_2d
- round
- select_between
- select_origin
- sin
- sinh
- sqrt
- tan
- tanh
- vec
- write_file
Ƭ brush_callback: callback<(brush
: script_brush, event
: script_brush_event) => void>
The type of callback used for brush events.
note
In lua, the first argument becomes "self" argument if using colon notation
Ƭ callback<T>: T | nil
Callback functions are unassigned by default, but may be assigned to by the user
Name |
---|
T |
Ƭ nil: undefined
This is the documentation for the Noggit scripting API. Functions not connected to a class are global and can be called from anywhere in a script.
• Const
procedures: procedures_class
singleton
▸ abs(arg
: number): any
Name | Type |
---|---|
arg |
number |
Returns: any
▸ acos(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ acosh(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ add_m2(filename
: string, pos
: vector_3d, scale
: number, rotation
: vector_3d): void
Spawns an m2 model in the world.
Name | Type |
---|---|
filename |
string |
pos |
vector_3d |
scale |
number |
rotation |
vector_3d |
Returns: void
▸ add_wmo(filename
: string, pos
: vector_3d, rot
: vector_3d): void
Spawns a wmo model in the world.
note
wmo models cannot be scaled.
Name | Type |
---|---|
filename |
string |
pos |
vector_3d |
rot |
vector_3d |
Returns: void
▸ append_file(file
: string, content
: string): void
Appends text to a file
note
This operation REQUIRES explicit permission from the user,
or it will throw an error.
Name | Type |
---|---|
file |
string |
content |
string |
Returns: void
▸ asin(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ asinh(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ atan(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ atanh(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ brush(name
: string): script_brush
Creates a new script brush
Name | Type |
---|---|
name |
string |
Returns: script_brush
▸ cam_pitch(): number
Returns the cameras pitch rotation (the one you almost NEVER want)
Returns: number
▸ cam_yaw(): number
Returns the cameras yaw rotation (the one you almost ALWAYS want)
Returns: number
▸ camera_pos(): vector_3d
Returns the current camera position
Returns: vector_3d
▸ cbrt(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ ceil(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ cos(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ cosh(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ create_image(width
: number, height
: number): image
Creates a new blank image
Name | Type |
---|---|
width |
number |
height |
number |
Returns: image
▸ dist_2d(from
: vector_3d, to
: vector_3d): any
Returns the 2d distance (ignoring y) between two vectors
Name | Type |
---|---|
from |
vector_3d |
to |
vector_3d |
Returns: any
▸ dist_2d_compare(from
: vector_3d, to
: vector_3d, dist
: number): number
Compares the 2d distance (ignoring y value) between two vectors to a given distance. This operation is significantly faster than manually comparing to the result of dist_2d
Name | Type |
---|---|
from |
vector_3d |
to |
vector_3d |
dist |
number |
Returns: number
▸ exp(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ floor(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ get_area_id(pos
: vector_3d): number
Returns the area id at a specific position.
The 'y' value is ignored for this operation.
Name | Type |
---|---|
pos |
vector_3d |
Returns: number
▸ get_chunk(position
: vector_3d): chunk
Returns the chunk at a given position. The tile at the position must be loaded into memory for the operation to be successful.
Name | Type |
---|---|
position |
vector_3d |
Returns: chunk
▸ get_map_id(): number
Returns the id of the currently open map
Returns: number
▸ holding_alt(): boolean
Returns true if the user is currently pressing the alt key
Returns: boolean
▸ holding_ctrl(): boolean
Returns true if the user is currently pressing the ctrl key
Returns: boolean
▸ holding_left_mouse(): boolean
Returns true if the user is currently pressing the left mouse button
Returns: boolean
▸ holding_right_mouse(): boolean
Returns true if the user is currently pressing the right mouse button
Returns: boolean
▸ holding_shift(): boolean
Returns true if the user is currently pressing the shift key
Returns: boolean
▸ holding_space(): boolean
Returns true if the user is currently pressing the spacebar
Returns: boolean
▸ lerp(from
: number, to
: number, ratio
: number): number
Returns the value at some percentage between two values.
Name | Type | Description |
---|---|---|
from |
number | the minimum range value |
to |
number | the maximum range value |
ratio |
number | the percentage to take (typically between 0-1) |
Returns: number
▸ load_png(path
: string): image
Loads a png file into an in-memory image.
Name | Type |
---|---|
path |
string |
Returns: image
▸ log(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ log10(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ make_noise(start_x
: number, start_y
: number, width
: number, height
: number, frequency
: number, algorithm
: string, seed
: string): any
Creates a new noisemap
Name | Type |
---|---|
start_x |
number |
start_y |
number |
width |
number |
height |
number |
frequency |
number |
algorithm |
string |
seed |
string |
Returns: any
▸ path_exists(path
: string): boolean
Returns true if a pathname exists already
Name | Type |
---|---|
path |
string |
Returns: boolean
▸ pow(a1
: number, a2
: number): any
Name | Type |
---|---|
a1 |
number |
a2 |
number |
Returns: any
▸ print(): void
Returns: void
▸ print(...args
: any[]): any
Prints out a message to the script window. (sometimes, with errors, print messages will be suppressed)
Name | Type |
---|---|
...args |
any[] |
Returns: any
▸ random_from_seed(seed
: string): random
Creates a new random generator from a specific seed.
Name | Type |
---|---|
seed |
string |
Returns: random
▸ random_from_time(): random
Creates a new random generator from the current system time.
Returns: random
▸ read_file(file
: string): string
Reads a file from the file system.
note
This operation does NOT require explicit permission from the user.
Name | Type |
---|---|
file |
string |
Returns: string
▸ rotate_2d(point
: vector_3d, origin
: vector_3d, angle
: number): vector_3d
Returns a 3d point around an origin, ignoring the y value.
Name | Type |
---|---|
point |
vector_3d |
origin |
vector_3d |
angle |
number |
Returns: vector_3d
▸ round(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ select_between(point1
: vector_3d, point2
: vector_3d): selection
Makes and returns a rectangular selection between two points.
Name | Type |
---|---|
point1 |
vector_3d |
point2 |
vector_3d |
Returns: selection
▸ select_origin(origin
: vector_3d, xRadius
: number, zRadius
: number): selection
Makes and returns a rectangular selection around an origin point
Name | Type | Description |
---|---|---|
origin |
vector_3d | The center point of the selection |
xRadius |
number | |
zRadius |
number |
Returns: selection
selection
▸ sin(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ sinh(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ sqrt(arg
: number): any
Name | Type |
---|---|
arg |
number |
Returns: any
▸ tan(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ tanh(a
: number): any
Name | Type |
---|---|
a |
number |
Returns: any
▸ vec(x
: number, y
: number, z
: number): vector_3d
Creates a new vector from its components
Name | Type |
---|---|
x |
number |
y |
number |
z |
number |
Returns: vector_3d
▸ write_file(file
: string, content
: string): void
Writes text to a file
note
This operation REQUIRES explicit permission from the user,
or it will throw an error.
Name | Type |
---|---|
file |
string |
content |
string |
Returns: void