Bot/zh: Difference between revisions
No edit summary |
No edit summary |
||
Line 39: | Line 39: | ||
'''%duration''' <跳跃高度> ''[天花板高度]'' |
'''%duration''' <跳跃高度> ''[天花板高度]'' |
||
对于给定的高度,返回一个跳跃的滞空时间(高度以方块为单位,天花板高度为可选 |
对于给定的高度,返回一个跳跃的滞空时间(高度以方块为单位,天花板高度为可选变量) |
||
Revision as of 05:26, 31 August 2022
MCPK 機械人是一個致力於取代 MathBot 來計算運動的 Discord 機械人。實際上,一直重新定義函數越來越令人厭煩,而且語法使用起來也不太方便。MathBot 作為通用計算工具仍然非常有用。
相對於 Mathbot 的優點:
- 更充實且更具描述性的輸出
- 內置了函數:不需要手動重定義它們。
- 機械人使用浮點數運算而不是分數,因此模擬更精確。
- 對於模擬運動:
- X 和 Z 運動都被考慮在內,並計入了動量閾值。
- 操作是從左到右讀取的,讀寫起來更方便。
- 所有操作都有方向這一可選參數。
距離
%distance <X> [Z]
返回 X 乘 Z 跳躍的真距(以方塊為距離單位,Z 方向為可選變量)
公式就是簡單的
範例:
- 4b 跳躍:%distance 4
- 3x3 跳躍:%distance 3 3
滯空時間
%duration <跳躍高度> [天花板高度]
對於給定的高度,返回一個跳躍的滯空時間(高度以方塊為單位,天花板高度為可選變量)
Examples:
- -1.5b jump: %duration -1.5
- 3bc +1 jump: %duration 1 3
Height
%height <jumpTicks> [ceilingHeight]
Returns the jump height of the player after n ticks (ceilingHeight is optional)
Examples:
- 12t jump: %height 12
- 2bc 9t jump: %height 9 2
Blip
%blip <repetitions> [initialHeight] [blipHeight] [lastJumpTicks]
Returns the height of the player after chaining consecutive blips (Y=0 is the bottom surface by convention).
- <repetitions> is the number of chained blips performed
- [initialHeight] is the player's initial height before the first jump (default: 0.0)
- [BlipHeight] is the height of the blip's top surface (e.g. 0.0625 for carpet, 0.1875 for trapdoor...)
- Unless specified with [lastJumpTicks], returns the peak of the jump by default (6 ticks).
Examples:
- starting from Y=200: %blip 4
- 17 chained blips on lilypad: %blip_top 17 0.015625
Simulate
%simulate <actions> (or simply %<actions>)
Reads the given actions from left to right, and simulates the resulting movement.
Actions:
Actions take two arguments:
- Ticks : the duration of the action, in ticks
- Direction (optional) : the direction (not facing) of the action, in degrees
Action | Description |
---|---|
stop, stop_air | No input |
sneak, sneak_air | Sneak |
sneak45, sneak45_air | Sneak with 45° strafe |
sneaksprint,
sneaksprint_air |
Sneak with sprint (used for 1.14+, or for sprint delay in air) |
sneaksprint45,
sneaksprint45_air |
Sneak with sprint (used for 1.14+, or for sprint delay in air) |
walk, walk_air | Walk |
walk45, walk45_air | Walk with 45° strafe |
sprint, sprint_air | Sprint |
sprint45, sprint45_air | Sprint with 45° strafe |
stopjump | Jump without moving |
walkjump | Jump without sprinting |
walkjump45 | Jump without sprinting, 45° strafe throughout the jump |
Lwalkjump
Rwalkjump |
Jump without sprinting, strafe Left or Right on the first tick. |
sprintjump | Sprintjump |
sprintjump45 | Sprintjump forward, start 45° strafe after the first tick |
Lsprintjump
Rsprintjump |
Strafe Left or Right on the first tick of a sprintjump.
Example: used for rex bwmm |
Lsprintjump45
Rsprintjump45 |
Strafe Left or Right throughout a sprintjump.
Example: used for 1bm 5-1 |
Add "max_" in front to get the maximum momentum with that action (repeats the action 20 times)
Special Tokens:
- Momentum, MM, and | sets the previous actions as momentum (resets the position minus the last tick)
- Blocks and b convert the output landing distance to blocks (± 0.6 to X and Z if nonzero)
- Meters, and m convert the output landing distance to meters (same values as default)
- Position, pos, and p convert the output to a relative position (used when you're not calculating jump distance)
Usage:
The parser reads the actions and tokens from left to right. Actions and tokens should be separated by spaces.
The Momentum token can be used anywhere between two actions.
The Blocks, Meters, and Position tokens are to be used at the end of the sequence (mutually exclusive).
Examples:
- hh timing: % sprint | sprintjump(12)
- rex bwmm: % walkjump(12,180) walk(1,180) Lsprintjump(12) | sprintjump(12)
- 1bm 5-1: % walkjump45(12,170) walk45(1,170) Lsprintjump45(1,-10) sprint45_air(11) | sprintjump45(14) b