Bot/zh: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
(Created page with "机器人")
 
(Created page with "MCPK-bot 是一款 Discord 机器人,旨在取代 MathBot 进行运动计算。事实上,一直重新定义函数让人厌烦,而且语法使用起来也不太方便。MathBot 作为一种通用计算工具仍然非常有用。")
 
(49 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div lang="en" dir="ltr" class="mw-content-ltr">
__NOTOC__
__NOTOC__
MCPK Bot 当前不可用,请转用 Mothball
MCPK-bot is a Discord Bot aiming to replace MathBot for movement calculations. Indeed, it was getting tiresome to redefine functions all the time, and the syntax is not very convenient to use. MathBot is still very useful as a general-purpose calculation tool.
([https://github.com/CyrenArkade/mothball 自述文件])。
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
'''Advantages''' over using Mathbot:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* Richer and more descriptive outputs
* The functions are built-in: no need to redefine them manually.
* The bot uses float math instead of fractions, so the simulation is more accurate.
* For simulating movement:
** X and Z movement are both considered, and momentum threshold is taken into account.
** Actions are read from left to right, which is way easier to read and write.
** All actions take direction as an optional argument.
</div>


MCPK-bot 是一款 Discord 机器人,旨在取代 MathBot 进行运动计算。事实上,一直重新定义函数让人厌烦,而且语法使用起来也不太方便。MathBot 作为一种通用计算工具仍然非常有用。


相对于 Mathbot 的'''优点''':


* 更充实且更具描述性的输出
* 内置了函数:不需要手动重定义它们。
* 机器人使用浮点数运算而不是分数,因此模拟更精确。
* 对于模拟运动:
** X 和 Z 运动都被考虑在内,并计入了动量阈值。
** 操作是从左到右读取的,读写起来更方便。
** 所有操作都有方向这一可选参数。


<div lang="en" dir="ltr" class="mw-content-ltr">
== Distance ==
</div>



<div lang="en" dir="ltr" class="mw-content-ltr">

<span id="Distance"></span>
== 距离 ==

'''%distance''' <X> ''[Z]''
'''%distance''' <X> ''[Z]''
</div>


返回 X 乘 Z 跳跃的真距(以方块为距离单位,Z 方向为可选变量)
<div lang="en" dir="ltr" class="mw-content-ltr">
Returns the real distance of a X by Z jump (distances in blocks, Z is optional)
</div>


公式就是简单的 <math>\sqrt{max(0,X-0.6)^2 + max(0,Z-0.6)^2}</math>
<div lang="en" dir="ltr" class="mw-content-ltr">
The formula is simply <math>\sqrt{max(0,X-0.6)^2 + max(0,Z-0.6)^2}</math>
</div>






<span id="Examples:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
==== Examples: ====
==== 范例: ====
</div>


* 4b 跳跃:%distance 4
<div lang="en" dir="ltr" class="mw-content-ltr">
* 4b jump: %distance 4
* 3x3 跳跃:%distance 3 3
* 3x3 jump: %distance 3 3
</div>




Line 53: Line 42:




<span id="Duration"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
== Duration ==
== 滞空时间 ==
</div>


'''%duration''' <跳跃高度> ''[天花板高度]''
<div lang="en" dir="ltr" class="mw-content-ltr">
'''%duration''' <jumpHeight> ''[ceilingHeight]''
</div>


对于给定的高度,返回一个跳跃的滞空时间(高度以方块为单位,天花板高度为可选变量)
<div lang="en" dir="ltr" class="mw-content-ltr">
Returns the duration of a jump with the given height (heights in blocks, ceilingHeight is optional)
</div>






<span id="Examples:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
==== Examples: ====
==== 范例: ====
</div>


* -1.5b 跳跃:%duration -1.5
<div lang="en" dir="ltr" class="mw-content-ltr">
* -1.5b jump: %duration -1.5
* 3bc +1 跳跃:%duration 1 3
* 3bc +1 jump: %duration 1 3
</div>




Line 81: Line 62:




<span id="Height"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
== Height ==
== 高度 ==
</div>


'''%height''' <起跳 Tick 数> ''[天花板高度]''
<div lang="en" dir="ltr" class="mw-content-ltr">
'''%height''' <jumpTicks> ''[ceilingHeight]''
</div>


返回玩家 n ticks 后的起跳高度(天花板高度可选填)
<div lang="en" dir="ltr" class="mw-content-ltr">
Returns the jump height of the player after n ticks (ceilingHeight is optional)
</div>






<span id="Examples:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
==== Examples: ====
==== 范例: ====
</div>


* 12t 跳跃:%height 12
<div lang="en" dir="ltr" class="mw-content-ltr">
* 12t jump: %height 12
* 2bc 9t 跳跃:%height 9 2
* 2bc 9t jump: %height 9 2
</div>




Line 108: Line 81:




<span id="Blip"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
== Blip ==
== 卡角 ==
</div>


'''%blip''' <重复次数> ''[初始高度]'' ''[卡角高度] [最后跳跃 Tick 数]''
<div lang="en" dir="ltr" class="mw-content-ltr">
'''%blip''' <repetitions> ''[initialHeight]'' ''[blipHeight] [lastJumpTicks]''
</div>


返回连续卡角后玩家的高度(按惯例,Y=0 作为地面)
<div lang="en" dir="ltr" class="mw-content-ltr">
Returns the height of the player after chaining consecutive blips (Y=0 is the bottom surface by convention).
</div>


* <重复次数> 为连续卡角的次数
<div lang="en" dir="ltr" class="mw-content-ltr">
* [初始高度] 是玩家第一次起跳前的初始高度(默认:0.0)
* <repetitions> is the number of chained blips performed
* [卡角高度] 是卡角所用平面的高度(例如:地毯为 0.0625,活板门为 0.1875……)
* [initialHeight] is the player's initial height before the first jump (default: 0.0)
* 除非指定了 [最后跳跃 Tick 数],否则按照默认值(6 tick)来返回跳跃的最高高度。
* [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).
</div>






<span id="Examples:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
==== Examples: ====
==== 范例: ====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* starting from Y=200: %blip 4
* starting from Y=200: %blip 4
* 17 chained blips on lilypad: %blip_top 17 0.015625
* 荷叶 17 连卡角:%blip_top 17 0.015625
</div>




Line 142: Line 105:




<span id="Simulate"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
== Simulate ==
== 模拟 ==
</div>


'''%simulate''' <操作>(或仅输入 '''%'''<操作>)
<div lang="en" dir="ltr" class="mw-content-ltr">
'''%simulate''' <actions> (or simply '''%'''<actions>)
</div>


从左到右读取给出的操作,并模拟运动的结果。
<div lang="en" dir="ltr" class="mw-content-ltr">
Reads the given actions from left to right, and simulates the resulting movement.
</div>






<span id="Actions:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Actions: ===
=== 操作: ===
</div>


操作拥有两个变量:
<div lang="en" dir="ltr" class="mw-content-ltr">
* 刻:操作的持续时间,以刻为单位
Actions take two arguments:
* 方向(可选):操作的方向(不是 facing),以度为单位
* Ticks : the duration of the action, in ticks
* Direction (optional) : the direction (not facing) of the action, in degrees
{| class="wikitable"
{| class="wikitable"
!操作
!Action
!介绍
!Description
|-
|-
|stop, stop_air
|stop, stop_air
|无输入
|No input
|-
|-
|sneak, sneak_air
|sneak, sneak_air
|潜行
|Sneak
|-
|-
|sneak45, sneak45_air
|sneak45, sneak45_air
|带有 45°斜跑的潜行
|Sneak with 45° strafe
|-
|-
|sneaksprint,
|sneaksprint,
sneaksprint_air
sneaksprint_air
|Sneak with sprint (used for 1.14+, or for sprint delay in air)
|带有疾跑的潜行(用于 1.14+,or for sprint delay in air)
|-
|-
|sneaksprint45,
|sneaksprint45,
Line 186: Line 142:
|-
|-
|walk, walk_air
|walk, walk_air
|行走
|Walk
|-
|-
|walk45, walk45_air
|walk45, walk45_air
|带有 45°斜跑的行走
|Walk with 45° strafe
|-
|-
|sprint, sprint_air
|sprint, sprint_air
|疾跑
|Sprint
|-
|-
|sprint45, sprint45_air
|sprint45, sprint45_air
|带有 45°斜跑的疾跑
|Sprint with 45° strafe
|-
|-
|stopjump
|stopjump
|无移动跳跃
|Jump without moving
|-
|-
|walkjump
|walkjump
|无疾跑跳跃
|Jump without sprinting
|-
|-
|walkjump45
|walkjump45
|无疾跑跳跃,在跳跃期间使用 45°斜跑
|Jump without sprinting, 45° strafe throughout the jump
|-
|-
|Lwalkjump
|Lwalkjump
Rwalkjump
Rwalkjump
|无疾跑跳跃,在跳跃的 tick 向左('''L'''eft)或右('''R'''ight)斜键。
|Jump without sprinting, strafe '''L'''eft or '''R'''ight on the first tick.
|-
|-
|sprintjump
|sprintjump
|疾跑跳跃
|Sprintjump
|-
|-
|sprintjump45
|sprintjump45
|疾跑跳跃,在跳跃期间使用 45°斜跑
|Sprintjump forward, start 45° strafe after the first tick
|-
|-
|Lsprintjump
|Lsprintjump
Rsprintjump
Rsprintjump
|疾跑跳跃,在跳跃的 tick 向左('''L'''eft)或右('''R'''ight)斜键。
|Strafe '''L'''eft or '''R'''ight on the first tick of a sprintjump.
Example: used for rex bwmm
范例:用于 rex bwmm
|-
|-
|Lsprintjump45
|Lsprintjump45
Rsprintjump45
Rsprintjump45
|疾跑跳跃,在跳跃期间向左('''L'''eft)或右('''R'''ight)斜跑。
|Strafe '''L'''eft or '''R'''ight throughout a sprintjump.
Example: used for 1bm 5-1
范例:用于 1bm 5-1
|}
|}
</div>


在操作前添加“max_”以获得该操作的最大加速(将该操作重复 20 次)
<div lang="en" dir="ltr" class="mw-content-ltr">
Add "max_" in front to get the maximum momentum with that action (repeats the action 20 times)
</div>






<span id="Special_Tokens:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Special Tokens: ===
=== 特殊符号: ===
</div>


* '''Momentum''','''MM''',以及 '''|''' 将当前的操作设置为助跑(在最后一 tick 重置位置的负值)
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''Momentum''', '''MM''', and '''|''' sets the previous actions as momentum (resets the position minus the last tick)
</div>


* '''Blocks''',和 '''b''' 将输出的落地距离转换成方块(如果不为零,在 X 和 Z 轴上 ± 0.6)
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''Blocks''' and '''b''' convert the output landing distance to blocks (± 0.6 to X and Z if nonzero)
</div>


* '''Meters''',和 '''m''' 将输出的落地距离转换成米(默认值)
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''Meters''', and '''m''' convert the output landing distance to meters (same values as default)
</div>


* '''Position''','''pos''',以及 '''p''' 将输出转换为相对位置(当你不在计算跳跃距离时使用)
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''Position''', '''pos''', and '''p''' convert the output to a relative position (used when you're not calculating jump distance)
</div>








<span id="Usage:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Usage: ===
=== 用法: ===
</div>


语法分析器从左向右读取操作和记号。所有的操作和记号应当用空格分隔。
<div lang="en" dir="ltr" class="mw-content-ltr">
The parser reads the actions and tokens from left to right. Actions and tokens should be separated by spaces.
</div>


'''Momentum''' 记号可以置于任意两个操作之间。
<div lang="en" dir="ltr" class="mw-content-ltr">
The '''Momentum''' token can be used anywhere between two actions.
</div>


'''Blocks''','''Meters''' 与 '''Position''' 记号置于语句末尾(不可同时使用)。
<div lang="en" dir="ltr" class="mw-content-ltr">
The '''Blocks''', '''Meters''', and '''Position''' tokens are to be used at the end of the sequence (mutually exclusive).
</div>








<span id="Examples:"></span>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Examples: ===
=== 范例: ===
</div>


* 延立:% sprint | sprintjump(12)
<div lang="en" dir="ltr" class="mw-content-ltr">
* hh timing: % sprint | sprintjump(12)
* rex bwmm:% walkjump(12,180) walk(1,180) Lsprintjump(12) | 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) |
* 1bm 5-1: % walkjump45(12,170) walk45(1,170) Lsprintjump45(1,-10) sprint45_air(11) | sprintjump45(14) b
</div>

Latest revision as of 04:56, 16 August 2023

Other languages:

MCPK Bot 当前不可用,请转用 Mothball (自述文件)。


MCPK-bot 是一款 Discord 机器人,旨在取代 MathBot 进行运动计算。事实上,一直重新定义函数让人厌烦,而且语法使用起来也不太方便。MathBot 作为一种通用计算工具仍然非常有用。

相对于 Mathbot 的优点

  • 更充实且更具描述性的输出
  • 内置了函数:不需要手动重定义它们。
  • 机器人使用浮点数运算而不是分数,因此模拟更精确。
  • 对于模拟运动:
    • X 和 Z 运动都被考虑在内,并计入了动量阈值。
    • 操作是从左到右读取的,读写起来更方便。
    • 所有操作都有方向这一可选参数。



距离

%distance <X> [Z]

返回 X 乘 Z 跳跃的真距(以方块为距离单位,Z 方向为可选变量)

公式就是简单的


范例:

  • 4b 跳跃:%distance 4
  • 3x3 跳跃:%distance 3 3



滞空时间

%duration <跳跃高度> [天花板高度]

对于给定的高度,返回一个跳跃的滞空时间(高度以方块为单位,天花板高度为可选变量)


范例:

  • -1.5b 跳跃:%duration -1.5
  • 3bc +1 跳跃:%duration 1 3




高度

%height <起跳 Tick 数> [天花板高度]

返回玩家 n ticks 后的起跳高度(天花板高度可选填)


范例:

  • 12t 跳跃:%height 12
  • 2bc 9t 跳跃:%height 9 2



卡角

%blip <重复次数> [初始高度] [卡角高度] [最后跳跃 Tick 数]

返回连续卡角后玩家的高度(按惯例,Y=0 作为地面)

  • <重复次数> 为连续卡角的次数
  • [初始高度] 是玩家第一次起跳前的初始高度(默认:0.0)
  • [卡角高度] 是卡角所用平面的高度(例如:地毯为 0.0625,活板门为 0.1875……)
  • 除非指定了 [最后跳跃 Tick 数],否则按照默认值(6 tick)来返回跳跃的最高高度。


范例:

  • starting from Y=200: %blip 4
  • 荷叶 17 连卡角:%blip_top 17 0.015625



模拟

%simulate <操作>(或仅输入 %<操作>)

从左到右读取给出的操作,并模拟运动的结果。


操作:

操作拥有两个变量:

  • 刻:操作的持续时间,以刻为单位
  • 方向(可选):操作的方向(不是 facing),以度为单位
操作 介绍
stop, stop_air 无输入
sneak, sneak_air 潜行
sneak45, sneak45_air 带有 45°斜跑的潜行
sneaksprint,

sneaksprint_air

带有疾跑的潜行(用于 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 行走
walk45, walk45_air 带有 45°斜跑的行走
sprint, sprint_air 疾跑
sprint45, sprint45_air 带有 45°斜跑的疾跑
stopjump 无移动跳跃
walkjump 无疾跑跳跃
walkjump45 无疾跑跳跃,在跳跃期间使用 45°斜跑
Lwalkjump

Rwalkjump

无疾跑跳跃,在跳跃的 tick 向左(Left)或右(Right)斜键。
sprintjump 疾跑跳跃
sprintjump45 疾跑跳跃,在跳跃期间使用 45°斜跑
Lsprintjump

Rsprintjump

疾跑跳跃,在跳跃的 tick 向左(Left)或右(Right)斜键。

范例:用于 rex bwmm

Lsprintjump45

Rsprintjump45

疾跑跳跃,在跳跃期间向左(Left)或右(Right)斜跑。

范例:用于 1bm 5-1

在操作前添加“max_”以获得该操作的最大加速(将该操作重复 20 次)


特殊符号:

  • MomentumMM,以及 | 将当前的操作设置为助跑(在最后一 tick 重置位置的负值)
  • Blocks,和 b 将输出的落地距离转换成方块(如果不为零,在 X 和 Z 轴上 ± 0.6)
  • Meters,和 m 将输出的落地距离转换成米(默认值)
  • Positionpos,以及 p 将输出转换为相对位置(当你不在计算跳跃距离时使用)



用法:

语法分析器从左向右读取操作和记号。所有的操作和记号应当用空格分隔。

Momentum 记号可以置于任意两个操作之间。

BlocksMetersPosition 记号置于语句末尾(不可同时使用)。



范例:

  • 延立:% 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) |