TextTask
A task for rendering text from newText
For this entire page assume:
local myText = models:newText("myCoolTextsName")
setText(text: string): TextTask
Sets the Text for this task render
Example:
myText:setText("Hi mom!")
getText(): string
Returns the Text from this task
Example:
myText:getText()
setAlignment(alignment: "LEFT" | "RIGHT" | "CENTER"): TextTask
Sets this Text alignment Can be either "LEFT", "RIGHT" or "CENTER" Default "LEFT"
Example:
myText:setAlignment("CENTER")
getAlignment(): "LEFT" | "RIGHT" | "CENTER"
Returns this Text alignment Default "LEFT"
Example:
myText:getAlignment()
setShadow(shadow: boolean): TextTask
Sets if the Text should render with a drop shadow Not compatible with "Outline" mode
Example:
myText:setShadow(true)
hasShadow(): boolean
Checks if this task text has shadow
Example:
myText:hasShadow()
setOutline(outline: boolean): TextTask
Toggles if the Text should render with a outline Always renders at full bright Not compatible with "Shadow" and "Emissive" modes
Example:
myText:setOutline(true)
hasOutline(): boolean
Checks if this task text has outline
Example:
myText:hasOutline()
setOutlineColor(color: Vector3): TextTask
Sets the outline color this Text should render. Takes a Vector3
of rgb values or a number per value. Only compatible with "Outline" mode.
Example:
myText:setOutline(true)
myText:setOutlineColor(255 / 255, 192 / 255, 203 / 255)
getOutlineColor(): Vector3
Gets this tasks text outline color
Example:
myText:getOutlineColor()
setWidth(width: number): TextTask
Sets this Text max width, wrapping the text into multiple lines Width of 0 or less do not wraps the text Default 0
Example:
myText:setWidth(1)
getWidth(): number
Gets this Text max width Default 0
Example:
myText:getWidth()
setWrap(wrap: boolean): TextTask
Sets if this Text should wrap lines
Example:
myText:setWrap(true)
hasWrap(): boolean
Check if this Text should wrap lines
Example:
myText:hasWrap()
setSeeThrough(seeThrough: boolean): TextTask
Sets if this Text can be seen behind walls Default false
Example:
myText:setSeeThrough(true)
isSeeThrough(): boolean
Check if this Text can be seen behind walls Default false
Example:
myText:isSeeThrough()
setBackground(background: boolean): TextTask
Sets if this Text should render its background Default false
Example:
myText:setBackground(true)
hasBackground(): boolean
Check if this Text should render its background Default false
Example:
myText:hasBackground()
setBackgroundColor(argb: Vector4): TextTask
Sets the background colour of this Text. Takes a Vector4
of argb values or a number per value. If the alpha value is not given, it will uses the vanilla value (as in the accessibility settings).
Example:
myText:setBackgroundColor(63 / 255, 255 / 255, 192 / 255, 203 / 255)
getBackgroundColor(): Vector4
Gets the this Text background color
Example:
myText:getBackgroundColor()
setOpacity(opacity: number): TextTask
Sets the opacity of this text
Example:
myText:setOpacity(0.5)
getOpacity(): number
Gets the opacity of this text
Example:
myText:getOpacity()
remove(): TextTask
Removes this text task from the parent model part
Example:
myBlock:remove()
getName(): string
Get this task's name
Example:
myBlock:getName()
setVisible(state: boolean): TextTask
Sets whether or not this task should be rendered
Example:
local myPage = action_wheel.newPage()
myPage:newAction():setOnToggle(function(state)
myBlock:setVisible(state)
end)
isVisible(): boolean
Checks if this task is visible
Example:
if myBlock:isVisible() then
-- do something
end
setLight(blockLight: number?, skyLight: number?): TextTask
Sets the light override value of this task Values are given from 0 to 15, indicating the block light and sky light levels you want to use Passing nil will reset the lighting override for this task
Example:
local blockLight = world.getLightLevel(player:getPos())
local skyLight = world.getSkyLightLevel(player:getPos())
myBlock:setLight(blockLight, skyLight)
getLight(): Vector2
Returns the light override value of this task
Example:
myBlock:getLight()
setOverlay(whiteOverlay: number?, hurtOverlay: number?): TextTask
Sets the overlay override value of this task Values you give are 0 to 15, indicating the white overlay and the damage overlay levels you want to use Passing nil will reset the overlay override for this task
Example:
local hurt = player:getNbt.HurtTime > 0
myBlock:setOverlay(hurt and 0 or nil, 1)
getOverlay(): Vector2
Returns the overlay override value of this task
Example:
myBlock:getOverlay()
setPos(pos: Vector3): TextTask
Sets the position of the task, relative with its attached part Uses model coordinates
Example:
myBlock:setPos(0, 16, 0)
getPos(): Vector3
Gets this task position
Example:
myBlock:getPos()
setRot(rot: Vector3): TextTask
Sets the rotation of the task, relative with its attached part
Example:
myBlock:setRot(0, 45, 22.5)
getRot(): Vector3
Gets this task rotation
Example:
myBlock:getRot()
setScale(scale: Vector3): TextTask
Sets the scale of the task, relative with its attached part
Example:
myBlock:setScale(0.4, 0.4, 0.4) -- myBlock:setScale(0.4) also works
getScale(): TextTask
Gets this task scale
Example:
myBlock:getScale()
setMatrix(matrix: Matrix4): TextTask
Sets the given matrix as the position matrix for this text task The normal matrix is automatically calculated as the inverse transpose of this matrix Calling this DOES NOT CHANGE the values of position, rot, or scale in the text task If you call setPos() or a similar function, the effects of setMatrix() will be overwritten
Example:
myBlock:setMatrix(matrices.mat4())
getPositionMatrix(): Matrix4
Recalculates the matrix for this text task, based on its current position, rotation, scale, and pivot, then returns this matrix
Example:
myBlock:getPositionMatrix()
getPositionMatrixRaw(): Matrix4
Returns the position matrix for this text task The Raw version of the function is different in that it doesn't recalculate the matrix before getting it
Example:
myBlock:getPositionMatrixRaw()
getNormalMatrix(): Matrix3
Recalculates the normal matrix for this text task, based on its current position, rotation, scale, and pivot, then returns this matrix
Example:
myBlock:getNormalMatrix()
getNormalMatrixRaw(): Matrix3
Returns the normal matrix for this text task The Raw version of the function is different in that it doesn't recalculate the matrix before returning it
Example:
myBlock:getNormalMatrixRaw()