Precise Testing

3min read
Sheet 15 of 47 · Scenarios

These actions are for tests that check exact numbers. Nothing sleeps and hopes. The bot holds keys for a set number of ticks, jumps at a known moment, and waits for the packet or line that proves something happened.

In a scenario they go in an action step, {do: action, action: jumpApex}. Over the API they are /act?action=....

Actions

ActionParametersWhat it does
holdkeys=forward,back,left,right,jump,sneak,sprint, ticks=20, wait=1Holds keys for a number of ticks, like a player pressing them. Overrides pathing while it lasts
jumpJumps as soon as the bot stands on something. A jump asked for mid-air or right after a teleport waits for the ground instead of being lost
jumpApextimeout=2000Jumps and returns at the top of the arc
airJumptimeout=2000Jumps, then sends the flight toggle at the top. This is the double jump a server sees through allowFlight
usehand, swing=1One right click in the air. No arm swing unless asked for: the client only swings for items that say so, and a swing with no block in reach reaches plugins as a left click
useHoldhand, ms=1000, everyHolds right click, then lets go. See below
releaseLets go of right click
hudAction bar, title, subtitle and boss bars on screen now
hudEventskind, match, since, n=50History of action bars, boss bars, titles, sounds and particles
markThe current position of the chat, packet and HUD streams
waitFortype, match, packet, entity, since, timeout=5000, distance, absent=1Blocks until something happens, or fails after the timeout. With absent=1 it is the other way round: it passes when nothing matched until the timeout and fails with what showed up
chatuntil=<regex>Returns the moment a line matches instead of waiting the full wait
packetssince=<mark>, entity=<id>Only packets after a mark, only packets about one entity
invfull=1Every slot, armor and off hand included, with every component value. Bukkit PDC shows up under custom_data

Holding right click

A held key uses the item again every 4 ticks (every=200 ms), so a gun keeps firing. For an item with a use time (bow, crossbow, trident, shield, food, potions) it is one press that is held. A custom item counts as one of those when it carries a consumable, food or blocks_attacks component. every=0 forces a single press, and the answer has presses.

Waiting for something

waitFor types:

TypeMatches on
chat, actionbar, bossbar, title, subtitle, sound, particlematch
packetpacket= a name part, entity= an id, match against the fields
entityGoneentity=
entityA type or name shows up, match
moveThe bot moved distance blocks

waitFor counts from the moment it is called. To catch something the previous action caused, take a mark first and pass the number as since:

curl "localhost:8767/act?bot=Tester&action=mark"
curl "localhost:8767/attack?bot=Tester&id=42"
curl "localhost:8767/act?bot=Tester&action=waitFor&type=packet&packet=DamageEvent&entity=42&since=613"

In a scenario, action takes as and field to keep the mark: action: mark, as: seen, field: packets, then since: ${seen} later.

timeout on an action step reaches actions that wait on their own (waitFor, jumpApex, airJump), so their own message explains a failure. The step gives them two extra seconds before it gives up.

Movement and physics

The bot's movement also takes the velocity the server sends: knockback, launches, setVelocity from plugins, explosions. Its physics knows Speed, Slowness, Jump Boost, Slow Falling and Levitation.

Loading the index

Enter openUp Down moveEsc close