Skip to content

Pattern API for Bee Swarm Simulator

Lookup for the Lua calls you use when writing a gather pattern. Each entry has a signature, what it does, and a short example.

Save your script under the patterns gather folder, then restart Revolution so the name appears in Gather → Fields → Select pattern.

patterns\gather next to the Revolution app, or %APPDATA%\RevolutionMacro\patterns\gather

Put these near the top of the file. Revolution reads them when it loads the script and fills defaults on the field card. If you omit size values, defaults are Length 4, Width 4, backpack percent 95, and Seconds 15 minutes (900).

Sets the display name in the Gather pattern picker.

ParameterTypeMeaning
namestringExact label shown under Select pattern
SetName("MyFirstPattern")

These only set field-card defaults. They do not move the character while gather runs.

CallParameterMeaning
SetLength(n)numberDefault Length on the field card
SetWidth(n)numberDefault Width on the field card
SetDistance(n)numberDefault Distance on the field card
SetAlignment(n)numberDefault Alignment amount on the field card
SetRepetitions(n)numberDefault repeat count on the field card
SetPosition("…")stringDefault sprinkler position (for example "bottom-right")
SetBackpackPercent(n)numberDefault backpack percent stop
SetSeconds(n)numberDefault gather seconds
SetWalkReturn(on)booleanPrefer walking back to hive
SetDriftComp(on)booleanDefault drift-compensation flag
SetInvertFB(on)booleanSwap forward/backward for this pattern
SetInvertLR(on)booleanSwap left/right for this pattern
SetZoom(level)numberDefault zoom on the field card (does not zoom during a gather run)
SetName("MyFirstPattern")
SetLength(4)
SetWidth(4)
SetDistance(3)
SetWalkReturn(true)

These set field-card defaults and change the character during the run when you call them in the body of the script:

CallParameterMeaning
SetPitch(angle)numberSets camera pitch
SetYaw(angle)number (07)Sets camera yaw. Use only SetYaw to change facing — not rotate-key presses. Even headings: 0 away from hives, 2 toward red HQ, 4 toward the hives, 6 toward blue HQ.
SetShiftLock(on)booleanTurns shift lock on or off
SetYaw(0) -- away from the hives
SetShiftLock(true)

Distances are in studs. One flower tile is about 4 studs, so authors often write n * 4. Timing follows Player Movespeed under Settings → Game → Movement — match in-game speed with no buffs.

Direction constants: Forward, Backward, Left, Right (also Direction.Forward, and so on).

Walks one direction for a distance, then continues. Blocks until the walk finishes.

ParameterTypeMeaning
directiondirectionForward, Backward, Left, or Right
studsnumberDistance to cover
Walk(Forward, 4 * 4)
Walk(Right, 16)

Starts both directions together and waits until that many studs of walk-time have passed. Useful for short diagonals without separate KeyDown / KeyUp pairs.

Walk({Forward, Right}, 3 * 4)

Starts a walk in the background and returns immediately. Pair it with another Walk when you want two axes at once (common for wall / corner compensation).

WalkAsync(Left, 8)
Walk(Backward, 8)
Sleep(20)

Walks like Walk, then adds extra studs from the current alignment level (and optional factor). Use when a leg needs to push further into a wall or corner under high alignment.

WalkAlign(Forward, 32)

Waits a fixed number of milliseconds.

Walk(Forward, 16)
Sleep(20)

Waits as long as walking that many studs would take at the current movespeed. Use with KeyDown / KeyUp when you hold keys yourself.

KeyDown(Key.Forward)
KeyDown(Key.Right)
SleepStuds(3 * 4)
KeyUp(Key.Forward)
KeyUp(Key.Right)

Waits ms scaled by alignment level — about 1× low, 1.25× medium, 1.5× high.

SleepAlign(40)

Movement keys respect SetInvertFB / SetInvertLR on the field card.

Taps a key once.

KeyPress(Key.RotLeft)
Sleep(30)

Holds or releases a key. Always pair them so a key is not left down.

KeyDown(Key.Backward)
KeyDown(Key.Left)
SleepStuds(4 * 4)
KeyUp(Key.Backward)
KeyUp(Key.Left)
CallMeaning
SetYaw(angle)Sets yaw during the run (07). Prefer this over RotLeft / RotRight key presses.
SetPitch(angle)Sets pitch during the run
SetShiftLock(on)Toggles shift lock during the run

For gather movement keys use Forward, Backward, Left, Right, plus ZoomIn / ZoomOut, Shift / LShift, Space, and number keys (OneSeven, Zero) for hotbar slots. Do not steer pattern facing with RotLeft / RotRight — call SetYaw instead (see Writing your first gather pattern).

SetYaw(6) -- toward blue HQ

Jumps (holds Space) and optionally walks while airborne. Used on field exits and ledges. The same call works in gather scripts when you need a hop.

Short forms: Jump(), Jump(Forward), Jump(Left, 200) (direction + delay in ms), Jump(250) (delay only, still walks Forward).

Pass a table when you need more control. Omit keys you do not need — defaults fill in.

KeyTypeDefaultMeaning
Directiontable of directions{Forward}One or more of Forward, Backward, Left, Right. Several entries walk a diagonal while jumping.
Delaynumber (ms)300Timing between pressing Space and walking. Under 100, walking starts while Space is still held. At 100 and above, Space releases first, then walking starts after the remaining wait.
Distancenumber (studs)4How far to keep walking after the jump timing (uses movespeed, same stud timing as Walk).
WalkBeforenumber (studs)0Walk in Direction this far before pressing Space. If Delay is greater than 0, those keys release before the jump. If Delay is 0, they stay held into the jump.
KeepWalkingbooleanfalseWhen true, leaves the Direction keys held after Distance so you can chain another walk without a gap.
Jump({
Direction = {Backward},
WalkBefore = 20,
Delay = 200,
Distance = 80,
})
Sleep(600)

Prefer Jump({...}) when you need more than a single direction or delay. For a bare Space tap without the walk timing, use KeyPress(Key.Space) instead.

During a gather run, Pattern holds the settings from the active field card. The table is read-only — change Length or Alignment on the card in Gather, not by assigning to Pattern.

FieldMeaning
Pattern.LengthLength from the field card
Pattern.WidthWidth from the field card
Pattern.DistanceDistance from the field card
Pattern.AlignmentAlignment amount from the field card
Pattern.RepetitionsRepeat count from the field card
local step = Pattern.Length * 4
local align = Pattern.Alignment
Walk(Forward, step + align)
Walk(Right, step)
FieldMeaning
Pattern.IterationWhich gather pass you are on (starts at 1 for many scripts’ first-pass setup)
Pattern.Interrupttrue when gather should yield to an interrupt
if Pattern.Iteration == 1 then
WalkAlign(Left, 65)
end
if Pattern.Interrupt then
Exit()
end

Updates the Status line and writes the same text to the log. Handy while testing a path.

Status("Corner reach")

Ends the script cleanly before the rest of the file runs.

if Pattern.Interrupt then
Exit()
end
MessageWhat to do
Failed to compile Lua patternFix the syntax error, save, restart
Failed to extract metadata from Lua patternKeep SetName("…") as a string literal near the top. Fix other Set* arguments
Pattern Execution FailedOpen Status logs, fix the Lua error, save, restart

If the character walks the wrong path after converts rather than failing outright, fix Size, Position, and Tilt on the field card and match Player Movespeed first — see Choose fields and patterns and Macro resets or gets stuck.

Patterns run as Lua scripts. Stick to the calls listed here plus normal Lua control flow (if, for, local).