Setters - anon-noob/mothball GitHub Wiki
Setters
Setters are functions that quite literally set things for you. Using setters will update the default attributes of the simulation.
Rotation (Facing)
# Other Aliases: facing, face, f
rotation(
angle: float = 0
)
Sets the player's default facing to angle
.
Turn
# No Other Alias
turn(
angle: float = 0
)
Turn the player angle
degrees AND set that new facing to be default.
Anglequeue
# Other Aliases: aq, qa
anglequeue(
*angles: float
)
This function takes as many angles as you wish separated by commas. This queues up angles to turn to for each subsequent movement tick AND sets those new angles as the default.
For example, aq(1,2,3,4) s(6)
is equivalent to f(1) s f(2) s f(3) s f(4) s(3)
.
On this version of Mothball, if a movement function is given a
rotation
argument, it uses thatrotation
argument and theanglequeue
is paused. That means doingaq(1,2,3) s s(1,10) s
is equivalent tof(1) s s(1,10) f(2) s
, with3
not being used in this sequence.
Turnqueue
# Other Aliases: tq, qt
turnqueue(
*angles: float
)
This function takes as many angles as you wish separated by commas. This queues up angles for the player to turn for each subsequent movement tick AND sets the resulting new angles as the default.
For example, tq(1,2,3,4) s(6)
is equivalent to turn(1) s turn(2) s turn(3) s turn(4) s(3)
, which is equivalent to aq(1,3,6,10) s(6)
.
anglequeue
andturnqueue
are separate queues which will be used whenenver available. To avoid confusion, please try to not use both on the same tick.
Setposz
# Other Aliases: posz, z
setposz(
z: float = 0
)
Sets the player's Z position.
Setposx
# Other Aliases: posx, x
setposx(
x: float = 0
)
Sets the player's X position.
|
Setpos and # Other Aliases: pos, xz
setpos(
x: float = 0,
z: float = 0
)
Sets the player's X and Z position. |
is an alias of setpos(x=0,z=0)
Setvz
# Other Aliases: vz
setvz(
speed: float = 0
Sets the player's Z velocity.
Setvx
# Other Aliases: vx
setvx(
speed: float = 0
Sets the player's X velocity.
Setv
# Other Aliases: vel
setv(
vx: float = 0,
vz: float = 0
)
Sets the player's X and Z velocities.
Air Sprint Delay
# Main function: air_sprint_delay
# Other Aliases: sprintdelay, sdel
air_sprint_delay(
sprint_delay: bool = True
)
Change the air sprint delay, which is present in 1.19.3-
If air sprint delay is toggled on, activating and deactivating sprint in midair is 1 tick delayed.
Inertia
# No Other Alias
inertia(
value: float = 0.005
)
Sets the inertia threshold. In 1.8 and below, it is 0.005
and on later versions, it is 0.003
. Mothball inertia is set to 0.005
by default.
Version
# Other Aliases: ver, v
version(
string: str = "1.8"
)
Sets the simulation's version and appropiately handles air_sprint_delay
and inertia
. See those functions for details on their functionality.
The version should be either in the form major.minor
or major.minor.patch
. For example, 1.21.2
.
Setprecision
# Other Aliases: precision, pre
setprecision(
precision: int = 6
)
Sets the simulation's output decimal precision (default 6 decimal places).
Setslip
# Other Aliases: slip
setslip(
value: float = 0.6
)
Sets the simulation's default GROUND slipperiness (default 0.6). Below are some common in game slip values.
block | slip value |
---|---|
normal | 0.6 |
slime | 0.8 |
ice/packed ice | 0.98 |
blue ice | 0.989 |
Speed
# No Other Aliases
speed(
amplifier: int = 0
)
Sets the player's speed potion effect, ranging from 0 to 255.
Slowness
# Other Aliases: slow
slowness(
amplifier: int = 0
)
Sets the player's slowness potion effect, ranging from 0 to 255. Slowness 7 and beyond are equivalent, even with speed. Futher explanation on the mcpk wiki status effects page
Var
# No Other Alias
var(
name: str = "",
input: Any = ""
)
Assign a new variable named name
to the value input
. Mothball will automatically detect if input
is a number or a string. For example, calling var(m, 2 + 4)
assigns m
to the value 6
. Variables persist across discord servers and channels until Mothball restarts.
Define
# Other Aliases: def
define(
name: str = "",
sequence: str = "",
*args: str = ""
)
Create a new function called name
, which when called will execute sequence
with *args
. The argument *args
are all comma separated. Custom defined functions persist across discord servers and channels until Mothball restarts.
For example,
def(
3bcbwmm,
f(angle) -wj(duration) -w | sj(duration),
duration, angle
)
3bcbwmm
is the namef(angle) -wj(duration) -w | sj(duration)
is the sequence, withangle
andduration
which will be our custom arguments.duration
andangle
are our arguments, which will be numbers.
Calling 3bcbwmm(2, 11)
is equivalent to f(2) -wj(11) -w | sj(11)
Limitations
This version of Mothball does not allow users to provide a default value for arguments in a user-defined functions. In the previous example, calling
3bcbwmm(3)
would raise an error.Additionally, the user cannot provide a docstring to give information about the user-defined function.