C
The Callback API
Add(iType, function) -- adds a callback and returns it's id
Add - Overload -- additional way to use callbacks, e.g. function OnLoad() end
Del(iType, id) -- deletes a callback
The Callback iTypes
Load -- gets called when lua engine finished loading
UnLoad -- gets called just before lua engine will be unloaded
GameEnd -- gets called when the game ends
Tick -- gets called 30x per second
Draw -- gets called every frame
WndMsg -- gets called with (msg, wParam) as input when the user presses a key
ProcessRecall -- gets called with (unit, proc) as input then anyone recalls
The Control API
.LeftClick(Table {x, y}) | .LeftClick(x, y) -- Executes a left mouse click
.RightClick(Table {x, y}) | .RightClick(x, y) -- Executes a right mouse click
.CastSpell(char | byte key) -- Casts a spell
.CastSpell(char | byte key, GameObject target) -- Casts a spell at a GameObject
.CastSpell(char | byte key, Number x, Number y) -- Casts a spell at a screen pos (2D)
.CastSpell(char | byte key, Number x, Number y, Number z) -- Casts a spell at an ingame pos (3D)
.CastSpell(char | byte key, Vector (3D) vec) -- Casts a spell at an ingame pos (3D)
.Move() -- Moves towards mousePos
.Move(Number x, Number y) -- Moves towards a screen pos (2D)
.Move(Number x, Number y, Number z) -- Moves towards an ingame pos (3D)
.Move(Vector (3D) vec) -- Moves towards an ingame pos (3D)
.Attack(GameObject target) -- Attacks a GameObject
.IsKeyDown(char | byte key) -- Check for a key being held down
.SetCursorPos(GameObject | Vector 3D | Vector 2D | x, y) -- Sets the cursor position
.KeyDown(char | byte) -- Holds down a key
.KeyUp(char | byte) -- Releases a key
- DumpDocumentation(fileName)
D
Dumps a Documentation file.
- GetTickCount
- GetImageInfoFromFile(path)
G
returns windows tick count
Number
returns width and height as table
Table {x, y}
- print(...)
P
prints any given input
S
The Sprite class.
Sprite
.x -- returns the x value
.y -- returns the y value
.pos -- returns the pos
.path -- returns the path
.width -- returns the width
.height -- returns the height
.scale -- returns the scale
.color -- returns the Color
:Draw() -- draws the sprite at .pos
:Draw(Vector (2D) vec) -- draws the sprite at vec
:Draw(Number x, Number y) -- draws the sprite at x y
:Draw(Table {x, y, w, h}, Vector (2D) vec) -- draws a rectangle of the sprite at vec
:Draw(Table {x, y, w, h}, Number x, Number y) -- draws a rectangle of the sprite at x y
:SetScale(Number scale) -- sets a sprite's scale
:SetScale(Number scaleX, Number scaleY) -- sets a sprite's scale
:SetPos(Vector (2D) vec) -- sets a sprite's pos
:SetPos(Number x, Number y) -- sets a sprite's pos
:SetColor(Color col) -- set a sprite's color
V
The Vector class.
Vector
Vector() => (0, 0, 0) -- Possible overload - 'nullvector'
Vector({x = 100, y = 100}) => (100, 100) -- Possible overload - 'xyz-table'
Vector(100, 0, 100) => (100, 0, 100) -- Possible overload - 'number, number, number'
Vector({x = 0, y = 50, z = 75}, {x = 100, y = 100, z = 100}) => (100, 50, 25) -- Possible overload - 'startPos, endPos'
.x -- The x value
.y -- The y value
.z -- The z value
.onScreen -- Used for 2D Vectors.
:To2D() -- returns screenpos from Vector3 (alias ToScreen)
:ToMM() -- returns minimap position from Vector3
:Clone() -- returns a new but equal Vector
:Unpack() -- returns x, y, z Values
:DistanceTo(Vector vec) -- returns distance to another vector or, if omitted, myHero
:Len() -- returns total length
:Len2() -- returns squared length (faster)
:Normalize() -- normalizes this vector (length == 1)
:Normalized() -- returns a cloned and normalized vector
:Center(Vector vec) -- center between 2 vectors
:CrossProduct(Vector vec) -- cross product of 2 vectors (alias: CrossP)
:DotProduct(Vector vec) -- dot product of 2 vectors (alias: DotP)
:ProjectOn(Vector vec) -- projects a vector on a vector
:MirrorOn(Vector vec) -- mirrors a vector on a vector
:Sin(Vector vec) -- calculates sin of 2 vectors
:Cos(Vector vec) -- calculates cos of 2 vectors
:Angle(Vector vec) -- calculates angle between 2 vectors
:AffineArea(Vector vec) -- calculates area between 2 vectors
:TriangleArea(Vector vec) -- calculates triangular area between 2 vectors
:RotateX(Angle phiX) -- rotates vector by phiX around x axis
:RotateY(Angle phiY) -- rotates vector by phiY around y axis
:RotateZ(Angle phiZ) -- rotates vector by phiZ around z axis
:Rotate(Angle phiX, Angle phiY, Angle phiZ) -- rotates vector around all axis
:Rotated(Angle phiX, Angle phiY, Angle phiZ) -- returns a cloned and rotated vector
:Polar() -- returns polar value
:AngleBetween(Vector vec2, Vector vec3) -- returns the angle formed from a vector to both input vectors
:Compare(Vector vec) -- compares both vectors, returns difference
:Perpendicular() -- creates a new vector that is rotated 90° right
:Perpendicular2() -- creates a new vector that is rotated 90° left
:Extend(Vector vec, Distance d) -- extends a vector towards a vector
:Extended(Vector vec, Distance d) -- returns a cloned and extended vector
:Shorten(Vector vec, Distance d) -- shortens a vector towards a vector
:Shortened(Vector vec, Distance d) -- returns a cloned and shortened vector
:Lerp(Vector vec, Delta d) -- creates a new vector, lerps it towards vector by delta d [0; 1]