AFN.Advanced Frequency Network AFN WIKI v1.9.3 中文
CREATE: ADVANCED FREQUENCY NETWORK

Connect everything.
Let data flow your way.

Manage wireless redstone with frequencies. Carry data over channels.
From remote switches to smart controls, use AFN to make all your devices work together.

MINECRAFT 1.21.1NEOFORGE 21.1.218+CREATE 6.0.0+
Cartoon workshop: a brass wireless console, pager, gears and a mechanical arm delivering parcels
v1.9.3
2026-11-26✦✧
Organize frequenciesTransfer dataLink devicesConnect everything. Start with AFN.
01
Start with the basics: organize wireless redstone with frequencies

Learn to express wireless redstone frequencies with text!

01
WIRELESS REDSTONE

Use a frequency to light a distant lamp

Prepare a Frequency Board, two Create Redstone Links, a lever and a Redstone Lamp.

1

Write a frequency on the board

Right-click the Frequency Board and enter workshop.lamp. A frequency is the address that lets senders and receivers find each other.

2

Install the boards and choose directions

Put a board in each link's frequency slot, and keep the other slot identical too. Set one link to send and the other to receive.

3

Activate the sender

Activate the sender with a lever to power the receiving lamp. Turn the sender off, and the distant lamp goes out too.

Sender
Brass Frequency Board with a written frequencyworkshop.lamp
Insert into
frequency slot
Create Redstone Link
Same frequency · Wireless transfer
Receiver
Create Redstone LinkInsert into
frequency slot
Brass Frequency Board with a written frequencyworkshop.lamp
Receiver's Redstone LampReceiver's Redstone Lamp

The sender is inactive. The receiver's Redstone Lamp is off.

02
FREQUENCIES

Give your factory memorable addresses

factory.line_1.motorFactory / production line / device

Dots separate address levels. Each board stores a primary frequency and up to five aliases. Senders use selectors; receivers use concrete addresses. History remembers literal addresses by level for reuse.

SyntaxMeaningExample
*Any characters within the current levelfactory.*.motor
?One character in the current levelfactory.line_?.motor
[A-C]A character set or range in the current levelfactory.[A-C].motor
**Occupies a whole level; matches zero or more levelsfactory.**.motor
!nameExclude a name at that level; multiple exclusions are allowedfactory.*.!private!test

Aliases: multiple entry points on one board

OR: match the primary frequency or any enabled alias.AND: the sender's selector must cover every enabled path. Cross-level response lets a shorter sender address match a deeper receiver address.

Both frequency slots must match

When an AFN board is present, matching ignores slot order. Two ordinary Create items retain Create's native order. The secondary slot may also hold an ordinary item; a second board is not required.

03
TRUST & RANGE

Who can receive, and how far can signals travel?

Authorization Frequency Board

Give the frequency to the right people

Stores the Owner, read/write permissions, hidden authorization frequency and installation lock. Ordinary boards have no identity restriction. Authorization Boards are checked by the server; unauthorized players cannot see the hidden primary frequency.

Computers are also limited by the bridge's enabled read, activation and configuration capabilities. See the full Lua reference for the differences between legacy credentials and current channel slots.

Long signals

Across distance and chunk-loading states

Enable long signals at both ends in the same dimension, using valid Authorization Boards. Unloaded remote locations are awakened on demand; frequency matching and permissions still apply.

Each Owner has a default quota of 15. Multiple channels on one device with the same Owner count as 1 device; different Owners are counted separately. Check server settings and the button tooltip for the actual quota.

AFN commands and server configuration

Long-signal management

The used / quota at the start of a long-signal button's tooltip shows registered devices and the current quota. For example, 3/15 means three registered devices out of fifteen. Usage is counted per Authorization Board Owner across the whole save, shared between dimensions. Reusing one Owner in two slots or several channels of a device counts once. With multiple Owners, each counts once and each needs available quota. Registered unloaded devices still count. Lowering a quota does not remove registrations; devices currently denied admission still appear in usage. By default, each device may enable up to ten long-signal channels; the server can lower this limit.

The quota accepts integers from 0–4096; 0 disables long signals for that Owner. Priority is: personal override → this save's server default → configuration infinite_range.default_owner_quota (default 15). set writes a personal override; allset saves the server default, while existing personal overrides retain priority. Neither command enables devices for the player.

CommandPermission levelEffect
/afn longsignal set <username> <quota>Level 3 or aboveSet the specified Owner's personal quota override.
/afn longsignal allset <quota> [confirm]Level 4Change the server's default quota; request first, then confirm.
/afn longsignal del <username>Level 3 or aboveRevoke this Owner's long-signal registrations and remove their personal override, restoring the server default quota.
/afn longsignal alldel [confirm]Level 4Revoke all registered Owners' long signals and clear all personal overrides; retain the server default quota.
/afn longsignal findAny playerList only your own quota-using devices, including names, dimensions, positions and channel counts. A moving structure's position may be temporarily unavailable.

username is resolved through the server's player profiles, including offline players whose profiles the server can resolve; selectors such as @a match only online players. find can only be executed by a player and accepts no target argument.

allset / alldel must be confirmed by the same executor within 600 server ticks (about 30 seconds at 20 TPS) by running the original command again with confirm; allset must use the same amount. After expiry, request again.

Copyable command examples (replace FactoryLin with the actual username)+

Give FactoryLin a quota of 20 devices; query your own devices:

/afn longsignal set FactoryLin 20
/afn longsignal find

Set the server default to 15 by running these two commands in sequence:

/afn longsignal allset 15
/afn longsignal allset 15 confirm

Revoke FactoryLin's long signals and clear their personal override:

/afn longsignal del FactoryLin

Clear all long-signal registrations and personal overrides by running these two commands in sequence:

/afn longsignal alldel
/afn longsignal alldel confirm

Channel character allowance

Channel text defaults to 1024 Unicode characters. These commands require operator permission level 2 or above and configure the text allowance shared by devices throughout the save.

CommandEffect
/afn information maxQuery the current character limit and corresponding byte budget.
/afn information max <characters>Set any positive integer, apply it immediately, synchronize online clients and save it to the world configuration. No second confirmation is required.

The setting is stored as information.max_characters in the world directory's serverconfig/create_afn-server.toml. The byte budget grows with the character allowance. Lowering the allowance does not delete existing content. Frequency names, expression-source length, array/geometry counts and parsing complexity retain separate limits.

For example, set the character limit to 65536, then query it:

/afn information max 65536
/afn information max

Message transfer budgets

Configure transfer budgets under [information_flow] in the same file. Pure signals send immediately; short and large messages have separate allowances. Congestion delays large messages, which apply only after complete delivery. Default values below are in bytes:

[information_flow]
short_bytes_per_tick = 8388608
large_bytes_per_tick = 8388608
short_message_bytes = 16384
slice_bytes = 262144
wire_bytes_per_tick = 8388608
wire_bytes_per_connection_tick = 1048576

The first two settings are the server's per-tick short- and large-message publication budgets (8 MiB each). short_message_bytes separates short messages (16 KiB); slice_bytes is the fair large-message share (256 KiB). The last two settings budget aggregate paced server output (8 MiB/tick) and each connection's paced output in either direction (1 MiB/tick). All settings accept positive values. Initial encoding, final parsing and rendering still cost time for large individual messages.

02
Enter the channel system: send data with mailboxes

Understand channels, send content, then choose how to transform and activate it.

04
CHANNELS & MAILBOXES

Let mailboxes carry information over channels

Meet the channel

What is a channel?

A channel carries both data and an activation signal. Data may be text, numbers, booleans or arrays; activation strength ranges from 0 to 15. Frequencies match senders to receivers, while channel names let bridges and panels reference their data.

Changing data does not activate a signal. After entering content, you still need redstone input, a change pulse, a timer or a condition.

Brass mailbox casing
Send and receive with mailboxes

Attach a message to a wireless signal

Sneak-right-click to configure a mailbox and choose receive, send or bidirectional mode. A sender stores content and transmits its current content to matching receivers when activated. Receivers can display that content or pass it to the attached device.

Directional and Modulated Receiving Mailboxes serve their corresponding reception scenarios. Stock Mailboxes read quantities, while Logistics Mailboxes place material orders.

Send your first message

1

Configure sender A

Select send mode, enter frequency factory.notice and set the channel value to Apples have arrived.

2

Configure receiver B

Select receive mode and match both frequency slots to A. Leave output syntax empty first to inspect the raw received content.

3

Activate A and watch B

Give A redstone input. B receives Apples have arrived. Enable automatic output on B when you want to display it on a device.

A · Sending mailboxSending mailboxfactory.notice
Channel valueApples have arrived
When active · Wireless transfer
B · Receiving mailboxReceiving mailboxfactory.notice
Received channel valueNo message received yet

Both ends use the same frequency. Turn on the lever to activate A and send its content to B.

To extract data, convert units or assemble content, configure channel output syntax in the next chapter. Activation timing and strength are configured separately afterward.

Channel text defaults to 1024 Unicode characters. Server owners can adjust the allowance and transfer budgets; see AFN commands and server configuration above for commands, permissions and configuration examples.

What happens under heavy message traffic?+

Pure signals send immediately. Short and large messages have independent allowances; congestion delays complete large-message publication. Configure information_flow in the world serverconfig/create_afn-server.toml: short_bytes_per_tick and large_bytes_per_tick default to 8388608 each; short_message_bytes defaults to 16384 and slice_bytes to 262144. Large data synchronization also follows wire_bytes_per_tick (8388608 by default) and wire_bytes_per_connection_tick (1048576), sending fragments over successive ticks. Initial encoding, final parsing and drawing still cost time for large individual messages.

05
A LITTLE DATA MAGIC

Channel output syntax: extract, transform and calculate

No full program required.

Put expressions inside ${…}. A single expression can retain a number or boolean type; mixing it with surrounding text creates text output. Mailboxes and hidden terminals read the received value, while bridges can also reference other channels by name.

Mailbox / hidden terminal${user.name}Read a JSON member${$[0]}Read text or the first component
Bridge${temperature}Read the “temperature” channel${add($.fuel1,$.fuel2)}Add two channels that each hold one number
Syntax workbenchPreset example demo
Received data
Channel output syntax
Output

Function shelf

Paths, arguments, missing values and limits+
06
MAKE IT AUTOMATIC

Activation conditions and signal strength

SettingEffect
Timed send / activationTrigger at the configured interval.
Activate immediately after changesSend one pulse after a manual value change is committed. Identical data, saving configuration and map-view operations do not trigger it.
Activate when condition is metStay active while true. A false result or error releases the condition source without affecting other sources. Checked only when relevant data changes.
Output signal strengthAccepts a number or output syntax, floors the result and clamps it to 0–15. Missing values or errors produce 0. Leave empty to follow the trigger source; local automatic activation without an external strength defaults to 15.

Activate a mailbox conditionally

For example, with channel value {"temperature":32,"ready":true}, this condition activates when temperature reaches 30 and ready is true:

${$.temperature} ≥ 30 & ${$.ready} = true

Mailboxes evaluate their own raw content. Wireless reception does not trigger conditional activation or change pulses. Bridges can also reference other channels by name. Supports =, ==, !=, <, >, ≥, ≤, & / &&, || and parentheses.

Turn signals into numbers

${strength($)}

Mailboxes read the raw received/input strength; bridges can use ${strength($.channel_name)}. No content is needed; inactive means 0. Hidden terminals' current output-strength rules still do not accept their own strength($).

Dynamic filter: The left list shows selected attributes and attributes of the current reference item. Click an attribute to copy its complete rule JSON. “Copy selected” preserves the current matching mode and inverted condition.

03
Connect everything

Let devices report their state and receive remote control.

07
READ · TRANSFORM · ACT

Connect everything: read and control devices

Mailboxes read device data into channels and write received content to devices. Automatic reading and output form a data path between devices. Hidden Channel Terminals have the same automatic output capabilities.

Read devicesStress, speed, stock…
Channel + output syntaxExtract · Convert · Assemble
Output to devicesDisplays, speed, pickup/deposit positions…
Expand for usage; copy code as a whole
04
More channel devices

Build your own interactions with screens, panels, maps and messages.

08
MORE CHANNEL DEVICES

More channel devices

From screen controls to positions and messages, choose an interaction that fits your needs on the same channel system.

Hold a Create Wrench and sneak-right-click to dismantle AFN blocks.

09
YOUR CONTROL ROOM

Put the entire workshop on a screen

Bridges expand horizontally and vertically, joining into a large screen when they form a complete rectangle. Channel regions can be freely resized, with no fixed 4×4 display limit. Sneak-right-click to open configuration.

WORKSHOP / CONTROL ONLINE
Material reserves
Iron · Copper · Gold · Coal · Wood
Stress load68%
Warehouse message

Copper ingots delivered.

Every corner of the workshop answers.
Interface illustration · Charts rearrange to fit the space

Layout and colors

Configure regions, names, standby status, backgrounds, controls, other text and pointer colors separately. Interaction and secondary confirmation are configured per region. Enabling “Display output syntax” automatically disables screen interaction.

Interfaces and files

Frequency, screen, Cimulink and CC:T have separate configuration tabs. Rear ports connect inputs and outputs. .bridge files import and export configuration and data, but do not import screen layouts.

Screen settings, field by field+
SettingMeaning
Show channel name / idle statusIndependently show the heading and idle indicator; both default on. Hiding them makes the freed space available to content.
Display output syntaxDefault off. When enabled, the screen displays the channel output expression result and disables interaction; the displayed result does not replace the raw value.
Screen interaction / change confirmationBoth default on. Interaction controls clicks, drags and history scrolling. Confirmation previews changes before committing them.
Integer adjustment / sensitivityInteger adjustment defaults off; enabling it changes values in whole-number steps. Sensitivity changes drag / wheel adjustment size without altering received data.
Background / control / other colorsSet the background, main controls, and remaining text / pointer elements separately; these do not change channel content.
Text choices / logistics presets / conversation repliesText choices are selectable values. Logistics presets define a name, address, items and quantities. Conversation replies send configured messages; they are not text styling.
Chart bounds / component names and ranges / horizontalBounds map values to length or angle. Component settings correspond to array indices. Horizontal orientation applies only to bar charts.
Map background / source / dynamic mode / rotationBackground enables terrain drawing; source selects Xaero / AFN terrain. Dynamic mode follows the hosting Sable structure; rotation corrects its direction.
Map connection / distance / coordinates / nearby entities / hostile mobsControl each display feature. Entity settings also determine whether their feature buttons appear and work. Lines and areas do not use the automatic self-to-target connection.
Conversation avatars / names / latest onlyThe first two control received sender identity display. Latest only shows one message; disabling it enables a scrollable history.
Sending avatar / name / clear chatEmpty sending identity uses anonymous defaults. Enabling clear chat adds a button that clears local history and the channel value.

Map data: multiple points, named lines and areas

All coordinates use world x,y,z. A single point can be written as 0,64,0; multiple points accept successive groups of three values, 0,64,0,32,64,16, and nested arrays:

[[0,64,0],[32,64,16]]

For a named point, use {"name":"Warehouse","position":[0,64,0]} or the x, y and z fields. This example displays points, lines and areas together. Each type can also be supplied alone; name is the visible name:

{
  "points":[{"name":"Warehouse","color":"#FF7043","text_color":"#FFE0B2","position":[0,64,0]}],
  "lines":[{"name":"Route","color":"#66BB6A","text_color":"#DCE775","points":[[0,64,0],[32,64,16]]}],
  "areas":[{"name":"Work Area","color":"#42A5F5","text_color":"#B3E5FC","points":[[0,64,0],[32,64,0],[32,64,16]]}]
}

Map JSON fields

FieldMeaning, format and omission
pointsTop-level point list. Each entry is [x,y,z] or a point object; omit lines and areas when only points are needed.
linesTop-level polyline list. Each line has its own ordered points list with at least two vertices.
areas / polygonsTop-level polygon list. Each area needs at least three ordered vertices and closes automatically. polygons is a bridge-map alias.
position / posA point object’s world coordinate array [x,y,z], in blocks; fractional values are accepted.
x / y / zAlternative point coordinates: x is east–west, y is height and z is north–south. Supply all three numeric values.
points (inside a line / area)The ordered vertices of that shape. Vertices may themselves be point objects with individual names or colors.
nameVisible point or shape name; omit it to draw geometry alone. label and title are also accepted name aliases.
colorGeometry color at collection, shape or vertex level. An inner valid value overrides its parent; omission inherits the parent or device color.
text_color / textColorName text color, independent of geometry color. Omission inherits the parent or device text color.

color controls geometry color, and text_color controls name color. The recommended format is #RRGGBB. If omitted, each follows the corresponding bridge color. Line and area vertices inherit the geometry color unless explicitly overridden. Also accepts #RGB, 0xRRGGBB, decimal RGB integers and [r,g,b].

A line needs at least two points; an area needs at least three. Vertices connect in order. areas also accepts the name polygons, and multiple lines and areas are supported. With geometry present, the automatic self-to-target line setting has no effect; the supplied geometry still displays. Bottom-right coordinates and distance use the first point and the device's own position.

Additional bridge-map structures

FieldMeaning, format and omission
type / coordinatesFor typed geometry: Point / MultiPoint use a coordinate triple / list; LineString / MultiLineString use a vertex list / lists; Polygon / MultiPolygon use rings / polygon collections. Coordinates remain Minecraft [x,y,z], not geographic longitude and latitude.
geometry / features / geometriesWith type=Feature, geometry holds one geometry; FeatureCollection uses features; GeometryCollection uses geometries. These are collections, not extra point attributes.
propertiesA feature’s metadata object; name / label / title and color / text_color inside it supply names and colors when not provided directly.

These permissive bridge-map forms also apply to terminals and DP radar. Pager map cards use the stricter points / lines / areas structure documented below.

Screen and per-mode field names, types and limits are listed individually in the display configuration field table. These Lua keys are separate from GUI-only controls.

10
DASHPANELS · AFN MODULES

DP panels

Get modules from AFN Modules at the bottom of the Dashpanels tab, place them on a panel and open properties with a Panel Wrench. Frequencies use the module's two slots in Panel Link. Hover over a module item and hold V to open its native Wiki page for its features and settings.

Control sliders

Standard, long, horizontal and long horizontal sliders share the same settings. They measure 3×5, 3×10, 5×3 and 10×3 panel pixels respectively. Long sliders match the diameter of the Large Radar.

Sliders send a value between their minimum and maximum, defaulting to 0–100. “Integer output” rounds to the nearest integer. Redstone strength defaults to 15 and ranges from 0–15. “Pulse after changes” is enabled by default: the slider stays active and continuously updates while operated, then retains a two-tick pulse after release. The activation condition works independently and also keeps the channel active while true. Initialization, reloading and configuration changes do not trigger change pulses.

Nodes: Enter 20,50,80 or [20,50,80], or use channel output syntax. Only nodes within the configured range apply, and markers appear by the scale. Dragging stops at the nearest node along the movement; release and drag again to cross it.

Sensitivity: A multiplier for dragging; smaller values give finer control. Standard sliders default to 1; long sliders to 0.4. Channel output syntax is supported. Hold right-click on the slider to fine-tune with the mouse wheel at half the configured sensitivity, ignoring nodes.

Channel output syntax: Leave empty to send the current value; plain text sends fixed text; an expression containing ${...} sends its evaluated result. Module names can reference values across the same panel network. Invalid expressions or missing sources stop output rather than reusing an old value.

Colors: Configure the slider, pointer and scale separately with RRGGBB or #RRGGBB. Node markers use the scale color.

Joystick

Drag the joystick to send a two-dimensional array [x,y]. Two corner points define the X and Y ranges, defaulting from -1,-1 to 1,1; integer output is supported. Corners, nodes, strength, activation conditions and output all accept channel output syntax.

Nodes and memory: Nodes accept 0,0, [[0,0],[1,1]] or channel output syntax. The default node is [0,0]. Memory is off by default: on release, the joystick returns at constant speed to the nearest node. With memory on, it stays at the released position. “Pulse after changes” is on by default, maintaining activation and updating values during operation, with a short pulse after release.

Gauges and display modules

  • Arc / circular gauges: Receive one number. Configure a name, name visibility, limits, and background, pointer and scale colors. The default range is 0–100; out-of-range values pin the pointer to an endpoint. The circular gauge occupies less space.
  • Small / large radios: Display the latest message in pager conversation format, including avatar, name and body. Plain text is also accepted. Right-click to clear the current message. Screen background and text colors are configurable.
  • Small / large information boards: Display channel content directly, with configurable screen background and text colors.
  • Buttons / switches: Configure a name, channel content and signal strength. Content and strength accept channel output syntax. A short button press sends a brief pulse; holding it sends continuously until release. A switch sends continuously while on. Button pressable parts also support custom colors.
  • Placeholder Channel Component: A flat 1×1 intermediate channel that receives content and strength for named references within the same panel network. Its color is configurable.

Colors accept RRGGBB or #RRGGBB. Empty content shows only the background. Receiving modules retain the latest content after the signal ends. Hiding a gauge's name does not affect name references. Animations follow Dashpanels' native behavior.

Radar and Large Radar

Both sizes share settings and center on the module's world position. They display bridge-map points, lines, areas and their names, including on moving Sable structures. They do not render terrain or adjust scale automatically. Coordinates are absolute world x,y,z, not relative offsets. Accepted input includes a single point, successive groups of three values, nested arrays or map JSON:

0,64,0
0,64,0,24,64,16
[[0,64,0],[24,64,16]]

Each line is an independent example. Only points within the scale radius appear. If coordinates are not visible, check their distance from the module and increase the scale.

{"points":[{"name":"Base","position":[0,64,0]}],"lines":[{"points":[[0,64,0],[24,64,16]]}],"areas":[{"points":[[0,64,0],[24,64,0],[24,64,16]]}]}
SettingEffect
Map rotationClockwise rotation in degrees, default 0; normalized over 360°. Supports channel output syntax; an expression error keeps the last valid rotation.
ScaleHorizontal radius in blocks, from 0.001 to 60000000; defaults to 64. Larger values show a wider area. Supports channel output syntax; invalid or out-of-range results keep the last valid scale.
Map background / grid colorsSet the disc background and circular grid colors separately.
Point colorDefault color for received points, lines and areas.
Fixed pointsAdditional world coordinates to display. Supports names, bridge map structures and channel output syntax.
Fixed point colorDefault color for fixed points, lines and areas.

Fixed points accept this shorthand. Without names, coordinate arrays alone also work. The map data's color and text_color override module colors.

{[0,64,0]:"Base",[24,64,16]:"Dock"}

LCD energy columns

Segmented battery-style displays come in vertical 1×4, horizontal 4×1, and long 2×10 and 10×2 sizes, all receiving one number. Limits default to 0–100. The first and second nodes divide low, middle and high ranges, colored red, yellow and green by default. Empty nodes divide the range into thirds. Nodes and limits support channel output syntax.

Message and information input formats

Radios receive pager JSON and display the latest message's avatar, name and content. Plain text appears as an anonymous message. Avatars use item:item_registry_id or player:player_UUID. messages can mix text and stock objects, rendering item icons as emotes:

{"avatar":"item:minecraft:apple","name":"Warehouse","message":"Restock complete"}
{"name":"Warehouse","messages":["Stock",{"minecraft:apple":8}]}

Information boards display arbitrary channel content directly without interpreting JSON as a conversation. Gauges and LCD energy columns receive a single number, not arrays containing multiple numbers.

Channel output syntax and previews

Numeric and content fields support channel output syntax: slider limits, nodes, strength, condition and output; joystick coordinates, strength, condition and output; gauge limits; button/switch content and strength; and map rotation, scale and fixed points. Empty slider and joystick output syntax sends raw values; plain text sends fixed text. When the input contains ${…}, an evaluated preview appears below it. Color fields still take color values.

All names in the same panel network are accessible, including every module on joined bases and other panels connected by cables. Names must be unique. AFN modules provide channel content; native modules provide only signal strength, using the highest output for modules with multiple outputs.

${slider_name}
${strength($.switch_name)}

Limits must evaluate to finite numbers with minimum ≤ maximum; conditions must evaluate to booleans. Sliders stop output when an expression is invalid.

Module settings reference+
Applies toSettingMeaning and default
All modulesName and Panel Link frequenciesThe name is used by expressions within the panel network; keep names unique. The two actual frequency slots handle wireless communication. A module name is not a wireless frequency.
Sliders / joystickSignal strengthRedstone strength while sending, default 15 and limited to 0–15. Accepts output syntax and is independent of the transmitted data.
Sliders / joystickActivation conditionEmpty disables this activation source. A true condition maintains activation; false releases only this source, preserving active operation or pulse sources.
Sliders / joystickPulse after changesDefault true: maintain activation and update values during operation, then retain a short release pulse. false disables this activation source; conditions can still activate the module.
Sliders / joystickInteger output and output syntaxInteger output defaults to false; enabling it rounds raw values. Empty output syntax sends the raw number / two-dimensional array. Configured syntax transforms the transmitted value without moving the control itself.
SlidersBounds and nodesDefault 0–100; empty nodes means no nodes, or enter values such as 20,50,80. Dragging stops at a node; release and drag again to cross it. Invalid bounds stop output.
SlidersSensitivity and slider / pointer / scale colorsSensitivity defaults to 1 on standard sliders and 0.4 on long sliders. Hold right-click and scroll for half sensitivity, ignoring nodes. Default colors are #D7AA5E, #FFFFFF and #FFFFFF respectively.
JoystickFirst and second coordinatesDefault -1,-1 and 1,1, defining the two ends of both axes; [x,y] is also accepted. Axes may be reversed independently.
JoystickSensitivityDefault 1; limited to a finite multiplier of 0.1–5. Larger values move the joystick farther for the same mouse movement. Accepts output syntax.
JoystickNodes and memoryDefault node [0,0]; accepts lists such as [[0,0],[1,1]]. Memory defaults to false: release returns at constant speed to the closest node. true preserves the released position.
Arc / circular gaugesBounds, Show name and three colorsBounds default to 0–100 and define the needle mapping. Show name affects only the visible label, not name references. Background, pointer and scale colors control those parts separately.
Radios / information boardsBackground and text colorsSet screen fill and lettering separately. Radios parse the latest conversation message; information boards display raw content. Right-click a radio to clear its current message.
Buttons / switches / Push ButtonChannel content and signal strengthContent defines the transmitted value and accepts expressions; strength defaults to 15. A normal button sends while held and releases afterward. Switches and Push Buttons toggle a persistent on/off state on each click.
Normal button / placeholderColorThe normal button colors its pressable part; the placeholder colors its body. Push Button uses the switch’s settings.
LCD columns, every sizeBounds, first node and second nodeBounds default to 0–100. Empty first and second nodes independently use one-third and two-thirds of the range. Nodes are clamped to the range and swapped if reversed.
LCD columns, every sizeLow / middle / high colorsLow is below the first node; middle starts at the first and ends before the second; high starts at the second. Defaults: #DF6259 (red), #E7C44F (yellow), #59C778 (green).
11
PORTABLE MAP TERMINAL

Portable Map Channel Terminal: a companion for map markers and planning

Map terminal / bridge map

Treat positions as data too

Transmit x,y,z, save locations, and show connecting lines and distance. Bridges can use Xaero terrain, the AFN map or a grid; coordinates and backgrounds can be hidden separately.

The mouse wheel zooms around the focus; middle-drag pans. View operations do not change channel values. Recenter brings self and target into view; dynamic mode rotates with the Sable structure's orientation.

Nearby-entity and hostile-mob buttons only appear when enabled in configuration. Clicking near a marker snaps to its coordinates. Right-click an entity marker on the portable terminal to continuously broadcast its position.

Right-click opens the shared GUI, with Channels and Map tabs; it remembers the last tab. In Channels, add, remove and select channels on the left; configure name, frequency, channel value, activation strength, long signals and output syntax in the middle; inventory is on the right. An older terminal retains its configuration as its first channel.

While holding the terminal, left-click broadcasts the aimed position or entity; middle-click stops the primary channel’s broadcast. Alt + wheel or number keys switch the primary channel and show its name. Other active channels keep broadcasting; broadcasts remain active in the player’s inventory or on a supported operating base. Leaving the inventory without such a base releases broadcasting.

Use the three bottom-right symbol buttons to create points, lines and areas. Drawing snaps to nearby visible points and vertices; newly drawn nodes use whole-block coordinates, and double-click ends line or area drawing. Creation saves data without broadcasting. Right-click to start broadcasting; right-click a shape in the current channel to rename, recolor, broadcast it alone or delete just that shape while keeping the others. Broadcasting one shape alone removes the other shapes. Click the left arrow to show channels; click the map to hide the list. The top tab bar appears when the pointer reaches it. The item screen also displays geometry, hiding names when crowded.

Terminals and bridges share the same point, line and area format; see map data formats. In output syntax, $ reads the current channel's raw value.

Xaero map channel

With Xaero World Map installed, click the AFN icon above the left button column on the M-key map. The popup over the map has a channel list attached on the left. Add, name and select channels; each independently configures two frequency reference slots, Enabled, Show on minimap and Long signal. Multiple channels display together; old settings become the first channel. The popup includes your inventory and preserves the map view when closed. At least one slot needs a valid AFN frequency board. References do not consume items; hover a frequency board and press Space to edit it. Settings are saved per player and require no portable terminal. Multiplayer requires the same AFN build on the server; server-side Xaero is unnecessary.

Receives the same coordinate, point, line and area formats as the bridge map, preserving names and colours. Minimap display additionally requires Xaero Minimap and its toggle. Geometry is parsed only when data changes, clipped to the visible map, and drawn over Xaero’s existing terrain. Only the current dimension is shown. Each channel’s last received content persists per player after broadcasts stop and across relogs. Disabling reception only hides it; reenabling reception restores the display. New messages replace the content; changing frequency or deleting a channel clears its old content.

Long signals use normal authentication-board and Owner quota checks. One player’s Xaero receiver counts as one device; all channels, both maps and repeated screen openings share that identity. Turning long signals off releases the registration. Closing the map does not disable reception.

World-map nodes, outlines and labels follow Xaero’s Waypoint Scale. Minimap nodes and outlines follow On-Map Waypoint Scale; labels follow UI Scale. Auto and Minecraft modes use Xaero’s own scale calculation. Geometry positions and coverage still follow world coordinates and map zoom.

12
HIDDEN CHANNEL TERMINALS

Hidden Channel Terminal: an upgrade over cable control

Configure a receive frequency on one face of an ordinary block without adding a visible device. Hold the configurator to view and edit configured faces.

Hold the configurator and right-click a non-AFN block face to create an empty configuration; right-click again to open the autosaving receive configuration. Blue outlines mean configured faces; red means empty configuration. Focusing a face shows its frequency.

Right-click Create / editSneak + right-click Remove faceMiddle-click CopySneak + middle-click Exit copying

A covered face can still receive. It weakly activates its host without powering neighbors. Automatic output shares mailbox capabilities. Configuration survives pistons, Create contraptions and Sable movement; permanently destroying the host removes it. Authorized faces require the relevant permissions to edit or remove.

13
CHANNEL PAGER

Channel Pager: a remarkable phone

Channel Pager

A message from the warehouse! Everything can send you a message—not just people!

Configure multiple channels, each serving as its own group chat.

Each channel independently configures its frequency, avatar/name toggles, ringtone, music disc, loop count and quick phrases. Search items to use as an avatar. Shortcut mappings cannot repeat within one channel.

Left-click while holding it to light the input screen; press Enter or left-click again to send a mapped message. Pagers also work on lecterns and Create Placards.

Let other devices message a pager or bridge+

Plain text appears anonymously. Chat JSON supports item/player avatars, names and message bodies; the bridge's Conversation mode uses the same format:

{"avatar":"item:minecraft:apple","name":"Warehouse","message":"Apples have arrived"}

Chat JSON fields

FieldMeaning, format and omission
avatarSender avatar string, such as item:minecraft:apple for an item icon or player:player_UUID for a player profile. Omission / empty text uses the default avatar; image URLs are not supported.
nameDisplayed sender name, limited to 64 characters. Omission / empty text displays an anonymous identity. This display name grants no authorization.
messageA single text body. Legacy aliases content and text are also accepted, in priority order message, content, text.
messagesStructured body: text, an item-quantity object, a map object, or an array mixing several entries in order. Used only when message / content / text are all absent or not strings. An empty string still takes priority.
item key: quantityA stock object inside the body, such as {"minecraft:apple":8}. The key selects an item and the number specifies its quantity. This displays an icon and amount; it does not create or transfer actual items.

messages mixes text with multiple stock objects. Item icons and quantities appear inline as emotes:

{"name":"Warehouse","messages":["Just received",{"minecraft:apple":8},"and",{"minecraft:iron_ingot":16},"Please collect"]}

Items accept registry IDs or uniquely identifiable names. Bridge conversations can show only the latest message or a scrolling history, with configurable avatars, names, replies and a clear button. Empty avatar/name settings use an anonymous identity.

Attach a map of points, lines and polygons+

Send a map terminal's points, lines and areas object directly to a pager, or place it in messages alongside text and stock icons. No extra wrapper is needed. The following example can be sent directly; position supplies the point coordinates:

{"points":[{"position":[0,64,0],"name":"Warehouse"}],"lines":[{"points":[[0,64,0],[32,64,16]],"name":"Route"}]}

The explicit type:"map" and geometry format also works for setting a card title and dimension. Pagers display a clickable map card; bridge conversations and DP radios show a summary:

{
  "name": "Dispatch",
  "messages": [
    "See the route",
    {
      "type": "map",
      "title": "Work route",
      "dimension": "minecraft:overworld",
      "geometry": {
        "points": [
          {
            "pos": [
              0,
              64,
              0
            ],
            "name": "Start",
            "color": "#ff8800"
          },
          [
            32,
            64,
            16
          ]
        ],
        "lines": [
          {
            "points": [
              [
                0,
                64,
                0
              ],
              [
                32,
                64,
                16
              ]
            ],
            "name": "Route",
            "color": "#66bb6a"
          }
        ],
        "areas": [
          {
            "points": [
              [
                0,
                64,
                0
              ],
              [
                32,
                64,
                0
              ],
              [
                32,
                64,
                16
              ]
            ],
            "name": "Work area",
            "color": "#42a5f5"
          }
        ]
      }
    },
    "Supplies",
    {
      "minecraft:apple": 8
    }
  ]
}

Map message fields

FieldMeaning, format and omission
typeUse the string map for an explicit wrapper. Omit it when supplying points / lines / areas directly.
geometry / mapWrapped geometry object containing points, lines and areas. These are alternative keys; do not provide both.
title / nameMap card title, preferring name over title. An explicit wrapper does not accept label; label is an additional name alias inside geometry or when points / lines / areas are supplied directly. Omission uses a default map title. This is at a different level from the outer chat sender’s name.
dimensionFull dimension registry ID, such as minecraft:overworld. Omission uses the viewer’s current dimension; other dimensions show geometry and a grid only.
points / lines / areasPoint, polyline and polygon lists. Lines need two distinct vertices; areas need three distinct vertices and must not self-intersect. Coordinates must be numeric arrays. Omit a list to supply none of that type.
position / pos / coordinatesAlternative coordinate keys in a point object, each taking [x,y,z]; use one. Separate numeric x, y, z fields are also accepted, but cannot be combined with an array coordinate key.
points / vertices / coordinates / pathAlternative ordered vertex-list keys inside a line or area object; use one, without combining aliases.
name / title / label (inside geometry)Visible point or shape name; omission hides the name.
color / text_color / textColorGeometry and name text colors, inherited collection → shape → vertex. Use either text_color or textColor. Color formats follow the bridge-map reference.

Client map settings prefer Xaero, then the AFN exploration map, then a solid-color grid; unexplored areas use a grid. A low-resolution preview is drawn when its card is visible in chat, even partially. Click for details, use the wheel to zoom, left- or middle-drag to pan, and reset to fit all geometry. Closing returns to the previous chat position.

Each map allows 128 vertices and 16 lines/polygons combined. Each message allows four maps and 256 vertices combined. The server channel-text allowance also applies. Invalid geometry stays visible as text instead of silently dropping vertices. Map messages never force-load distant world chunks.

14
BUILD IT AGAIN

Copy a project and reassign identities

FrequencyAuthorizationEdit

Schematic Channel Editor

Supports Create and both old and new Sable schematics. Search frequencies, aliases, items, devices and location types. Expand devices with multiple frequencies, replace items and press Space to edit boards. Entirely empty groups are hidden, but an existing group's empty secondary slot can still accept an item.

One-click authorization binds to you; assign read/write permissions from a player list. The Edit tab adds or changes dot-separated prefixes/suffixes, or globally replaces text in primary frequencies and aliases.

Saved files are placed under afn/ in the schematics directory and retain recognizable original names. Anyone may build them. Once verified and the actual printer is identifiable, Authorization Boards bind to that printer while preserving shared permissions. Unverified copies do not inherit the original Owner.

Tickets and access control

Ticket Issuers use Authorization Boards to issue tickets. Ticket Validators check frequency and identity, then accept tickets and grant access; a full inventory does not consume a ticket. Authorization Card Readers and Identity Verification Pillars verify identities and emit redstone pulses on success. Authorization Boards themselves are not consumed.

15
ORDER BY CHANNEL

Logistics Mailbox: send a complete order through a channel

A Logistics Mailbox receives order text from a channel and submits the requested items and amounts to a bound Create logistics network. A Stock Mailbox reads inventory; use the Logistics Mailbox to request actual deliveries.

Connect the network, then send an order

1

Tune the logistics network

Hold a Logistics Mailbox and right-click a Stock Link, Stock Ticker or another node already connected to the target network, then place the tuned mailbox. Check that the network has available packagers and inventory, and build a delivery route to the destination.

2

Match the channel frequencies

Configure matching frequency slots on the Logistics Mailbox and its sender, such as a regular mailbox or bridge. The Create network binding and AFN frequencies are separate settings; both must be correct.

3

Write text and activate

Put a complete command below in the sender's channel content, then activate once at a strength greater than 0. Changing content without activation does not place an order. Replace “Canteen” with your actual delivery address.

Request several items with different quantities at once

This single command requests 16 apples, 8 bread and 1 cake, all for “Canteen”. The entire JSON object is one command; line breaks are optional:

{
  "address": "Canteen",
  "items": [
    {"item": "minecraft:apple", "count": 16},
    {"item": "minecraft:bread", "count": 8},
    {"item": "minecraft:cake", "count": 1}
  ]
}

Each object in items is one requested item type. item selects the item and count sets its amount. The top-level address supplies a shared destination; no saved item group is required.

Send entries in one list to different addresses+

An entry's own address overrides the shared address. Here the apples go to “Canteen” and the bread to “Worksite”. Entries with the same address form an order; different addresses are planned separately. Actual deliveries may use multiple packages.

{
  "address": "Canteen",
  "items": [
    {"item": "minecraft:apple", "count": 16},
    {"item": "minecraft:bread", "count": 8, "address": "Worksite"}
  ]
}
Request one item: three equivalent forms+

Each block below separately requests 16 apples for “Canteen”. Send any one of them.

item=minecraft:apple,count=16,address=Canteen
minecraft:apple,16,Canteen
{"item":"minecraft:apple","count":16,"address":"Canteen"}

Items accept registry IDs or names the server can resolve uniquely, such as “Apple”. Use a full ID such as minecraft:apple when names are ambiguous or unrecognized. Counts are individual items, not stacks.

Fields and omitted values+
Field / locationMeaning and fallback
itemAn item registry ID or unique name. JSON requires a string; every items entry must provide item.
count (single item)The number of items requested. Omission uses the General page's default count.
count (items entry)Entry count takes priority, then top-level count, then the General page's default count. Per-slot quantities from the General page are not used here.
address (items entry)Entry address takes priority, then top-level address, then the General page's default address. Every resolved entry needs a nonempty address and a positive integer count.
nameSelects a group saved on this mailbox's Item Groups page, not an item's display name. Choose only one top-level selector: name, item or items.
count (named group)Multiplies every saved quantity in that group. Omission means ×1, independently of the General page's default count.

Field names are lowercase. JSON counts must be integer numbers such as 16, not "16" or 16.0. The top level accepts only name / item / items / count / address; items entries accept only item / count / address. Unknown or duplicate fields are invalid.

Save a recurring order as an item group+

Create “Breakfast” on the Item Groups page, add 16 apples, 8 bread and 1 cake, and set its shared address to “Canteen”. The channel can then send only the group name to request the entire saved list:

Breakfast

For a one-time double order to “Worksite”, send the following. It requests 32 apples, 16 bread and 2 cakes without modifying the saved group:

Breakfast,count=2,address=Worksite

The equivalent JSON form:

{"name":"Breakfast","count":2,"address":"Worksite"}

Group address priority is command override → group shared address → entry address → General default address. To give entries separate destinations, leave the group's shared address empty and set each entry's address.

General defaults and direct redstone activation+

The General page can select default items with per-slot quantities and a default address, or a default item group. A selected default group takes priority; otherwise the default item list is used. Defaults fill omitted fields, while a fully explicit command needs no defaults. A new mailbox has no completed default count or address; omitting count does not automatically request one item. A positive count must be available from its defaults.

When expanding the General page's default item list, an omitted count preserves each slot's quantity; an explicit count assigns that amount to every entry, rather than multiplying it. A named group's count remains a multiplier.

With the network binding and default list complete, one rising redstone edge at the Logistics Mailbox submits the default order. A positive wireless signal without text content also requests the defaults. A sustained unchanged signal does not order every tick. Release the signal and activate again to repeat the same order.

Limits and troubleshooting+

The GUI allows 9 default item types and 9 item types per group, with 64 saved groups; JSON items accepts 32 entries. Each count must be an integer from 1 to 1,000,000, with at most 4,000,000 items in the whole request. Group names allow 48 characters and addresses 128. The command parser accepts 2048 characters; wireless text also follows the server channel-text allowance. Save a long list as an item group and send only its name.

Status / symptomWhat to check
Network not boundTune the held mailbox against a valid network node, then place it. Matching channel frequencies alone do not bind a logistics network.
Invalid command or configurationCheck JSON brackets and quotes, lowercase field names, integer counts, nonempty addresses and exact item IDs / group names. A bare top-level array is not supported.
Logistics network unavailableCheck the bound network, stock for the complete request, packager connections and busy state. Insufficient stock for any requested item, or a busy required packager, rejects the whole list instead of dispatching a partial order. Failed orders do not retry automatically; resolve the issue and trigger again.
No response, or the same order will not repeatCheck both frequency slots, sender strength and access. Writing content alone is insufficient. Release the signal and activate again.
Request submitted, but delivery has not arrivedSubmitted means the order reached Create's logistics system. Check package addresses, transport routes and receiving devices. The Logistics Mailbox has no inventory of its own.

The mailbox's in-game Help entry opens its dedicated tab in the shared manual, with search, favorites and copyable examples.

05
APIs and development

Extend channels through CC:Tweaked, Synaxis and public interfaces.

16
A PROGRAMMABLE WORKSHOP

Ready to program? The interfaces are ready too

With CC:Tweaked installed, place a computer beside the bridge or connect through a wired modem. Enable the required bridge capabilities, then use the bundled afn module:

local afn = require("afn")

for _, channel in ipairs(afn.channels()) do
  print(channel.name, channel.primary_frequency)
end

-- door is an existing channel name on the bridge
local result = afn.pulse("door")
assert(result.success, result.error)

Screens can be programmed too

afn.screen() / afn.set_screen() manage the screen; afn.display() / afn.set_display() configure channel regions, modes, interaction and styling. Set data and activate signals with separate calls.

Two more integration paths

Synaxis connects activation, value-input and value-output ports. Add-ons use the public Channel API for endpoints, permissions and long signals. Developer documentation is in the project's Channel SDK.

Open the full Lua Function Manual
Read the complete API, return values, events and error codes here+

AFN Bridge Lua Function Manual

Applies to AFN 1.9.3. AFN WIKI · Chinese manual · English overview

Reference for functions, permissions, events, error codes, and compatibility fields in the require("afn") package and the raw afn_bridge peripheral.

Five-minute quick start

1. Channel structure

Each channel can have a primary frequency, an optional secondary frequency, an optional value, and an activation state at the same time; frequency and information are not mutually exclusive storage types:

Channel name + primary frequency + optional secondary frequency + optional value + activation state

Create a channel in the bridge GUI:

Setting Example
Channel name door
Primary frequency factory.door
Secondary frequency None
Channel value CLOSED
Transmission/reception Allow sending and receiving

door in the code is the channel name, not the primary frequency. Except for temporary transmission functions, most APIs look up channels by name.

2. Connect and inspect channels

Place the computer directly next to the bridge, or connect it through a wired modem. Run:

local afn = require("afn")

local bridge, bridge_name = afn.find()
print("bridge:", bridge_name)

for _, channel in ipairs(afn.channels()) do
  print(channel.name, channel.primary_frequency)
end

You should see door factory.door. afn, bridge, and channel are ordinary Lua variable names used in these examples; you can choose different names.

3. Send a one-second signal

local afn = require("afn")
local result = afn.pulse("door") -- Defaults to strength 15 for 20 ticks
assert(result.success, result.error)

pulse activates a channel that already exists in the bridge. Because this channel has a valid primary frequency, it sends a Create/AFN wireless signal. If the primary frequency is empty, it still activates inside the bridge, but no wireless transmitter is registered.

4. Read and write values directly

local afn = require("afn")

local before = assert(afn.value("door"))
print("before:", before.value)

local result = afn.set_value("door", "OPEN")
assert(result.success, result.error)

local after = assert(afn.value("door"))
print("after:", after.value)

An ordinary overwrite does not require a revision. set_value does not itself activate the channel; condition rules configured separately in the GUI may activate it when its value changes. Activation does not automatically create a value either.

5. Set the primary and secondary frequencies

local afn = require("afn")

assert(afn.set_primary_frequency("door", "factory.door").success)
assert(afn.set_secondary("door", "manual", "factory.zone_a").success)

-- Clear the second ordinary frequency when a secondary frequency is not needed:
assert(afn.set_secondary("door", "none").success)

Secondary frequency modes are none, manual, and auth. none clears the secondary frequency; manual writes ordinary frequency text. Players should configure authentication boards for the current tiled bridge in the GUI's actual channel frequency slots; Lua cannot submit or reconstruct Owner, ACL, or hidden authentication identities. auth retains the legacy bridge's linked credential semantics. It does not create an authentication board in the current channel, and without the legacy credential it cannot establish a valid authenticated wireless link.

Common operations at a glance

Run local afn = require("afn") before each of the following examples.

Purpose Shortest form Permission
List all channels afn.channels() Read
Read a complete channel afn.get("door") Read
Read the value, including the absent state afn.value("door") Read
Read primary and secondary frequencies afn.frequency("door") Read
Activate for 1 second afn.pulse("door") Activate
Activate continuously afn.set("door") Activate
Stop continuous activation created by this computer afn.clear("door") Admitted
Write a value directly afn.set_value("door", "OPEN") Configure
Clear to "no value" afn.clear_value("door") Configure
Change the primary frequency afn.set_primary_frequency("door", "factory.door") Configure
Change the ordinary secondary frequency afn.set_secondary("door", "manual", "factory.zone_a") Configure
Transmit temporarily for 1 second afn.pulse_temporary("factory.bell") Activate
Read the whole screen's dimensions and regions afn.screen() Read
Configure the screen layout afn.set_screen({placements={...}}) Configure
Read a channel's screen settings afn.display("door") Read
Change the interaction mode and colors afn.set_display("door", {mode="switch", control_color=0x88CC66}) Configure

Optional parameters, variables, and revision

Square brackets are not Lua code

Square brackets in signatures indicate optional parameters:

afn.set_value(channel, value[, revision[, bridge_name]])

Do not type the square brackets in an actual call. With only one bridge, you can usually omit the final bridge_name. To specify the last parameter while skipping an intermediate parameter, use nil as a placeholder:

afn.set_value("notice", "新内容", nil, "left")
afn.set_secondary("door", "none", nil, "left")

bridge_name is the peripheral name assigned by CC, such as left or a name on the wired network; it is not a channel name, block title, or primary frequency.

What old and current mean

local current = assert(afn.value("counter"))

current is simply a local variable name chosen by the author to hold the returned table:

{
  present = true,
  kind = "real",
  value = 12,
  revision = 7
}

It is not an AFN keyword. old, data, or counter_state would work just as well.

Why revision can usually be omitted

To replace a value with specific content, write it directly:

local result = afn.set_value("notice", "列车即将进站")
assert(result.success, result.error)

Passing the old revision is recommended only when the new value depends on the old value you just read, such as incrementing a counter:

local current = assert(afn.value("counter"))
local result = afn.set_value("counter", current.value + 1, current.revision)

if not result.success and result.error == "revision_conflict" then
  printError("The value has changed; read it again before recalculating")
else
  assert(result.success, result.error)
end

The revision is a monotonically increasing version number on each bridge. Clearing a value also advances its tombstone revision, so the sequence "value present → no value → value present again" does not cause an ABA misidentification. After a conflict, read again and recalculate instead of blindly retrying submissions in a loop.

Unified channels and values

Three writable value types

Lua input kind Read result
string text string
boolean boolean boolean
Finite number real number
Contiguous array of 1–128 finite numbers real Array for multiple elements; a single element still returns a number

Text defaults to 1024 Unicode code points; administrators can change the server channel-text allowance, with a matching byte budget. Real arrays reject empty tables, sparse tables, nonnumeric elements, NaN, positive or negative infinity, and inputs with more than 128 elements. Valid components are normalized toward zero to at most three decimal places at the model boundary. An invalid write is rejected atomically, with nothing partially saved. Chart and switch screen settings display up to 8 components; this does not limit the length of arrays stored or transmitted by a channel.

local ok1 = afn.set_value("notice", "列车即将进站")
local ok2 = afn.set_value("door_open", true)
local ok3 = afn.set_value("pose", {12.5, 64, -8, 0, 0, 0, 1})
assert(ok1.success and ok2.success and ok3.success)

local bad = afn.set_value("pose", {1, 2, 0/0})
print(bad.success, bad.error) -- false invalid_information_value

Empty text "" is a present text value. Only clear_value produces present=false. Legacy coordinate/player values in saved data can be read, but remain read-only.

Wireless value transmission boundaries

  • AFN bridge → AFN bridge: signal strength can carry a snapshot of the current value.
  • AFN bridge → ordinary Create receiver: only strength is transmitted; ordinary devices ignore the value.
  • Ordinary Create transmitter → AFN bridge: can activate the channel, but does not change its value.
  • Incoming wireless signals are not immediately relayed as outgoing wireless signals. Only a later new local activation can send the currently stored value as a new local snapshot.
  • The highest strength wins across multiple sources; sources carrying values select a single winner by strength and stable source ID.
  • Write priority within the same tick is player > CC:T > Synaxis > wireless.

Eight screen modes

default, switch, bar, gauge, map, logistics, stock, and dialogue correspond to text, switches, bar charts, gauges, maps, logistics, stock, and dialogue. Modes interpret the unified channel value without restricting its storage type; logistics separately displays preconfigured supply groups. Dialogue uses pager JSON and supports text and item-count emotes, a latest-message view or history list, and simple replies. Invalid values only cause a visual fallback; switching views never overwrites the raw value.

Integer adjustment affects only screen touch controls, not writes from CC:T, Synaxis, wireless signals, or the ordinary GUI. Tiled bridges use rectangular regions instead of cycling through full-screen channels. The legacy display-list and selected-channel functions remain available; new programs should use screen/set_screen.

Permissions and performance

Capability Typical functions
Read channels/get/value/frequency, screen switching
Activate set/pulse/toggle, temporary transmissions
Configure Value writes, CRUD, primary/secondary frequencies, display lists, Synaxis, redstone bindings
Continued admission only clear, clear_temporary*, for fail-safe cleanup

Read, activation, and configuration switches are managed independently in the bridge GUI. Current ComputerID admission checks retain the legacy linked device credential: without that credential, nonnegative ComputerIDs are accepted; when a credential exists, its whitelist is checked, and an empty whitelist rejects all computers. An authentication board in a channel slot and this legacy device credential are separate settings. Placing an authentication board in a channel does not establish that computers are protected by a whitelist; check the GUI's CC capability switches.

Lua cannot replace a real authentication board it lacks permission to manage. Updating or removing such channels may return frequency_board_permission_denied. An authorized player must edit the GUI frequency slots when the identity needs to change.

A session is established for each ComputerID when it connects. Recalculation and updates occur only when authentication boards, whitelists, or capability switches change. Each function call performs only an O(1) cached read, without scanning the world, block entities, NBT, ACLs, or whitelists. Revoking admission or activation permission clears the continuous leases and temporary transmissions left by that computer.

Incorrect argument types or counts, missing peripherals, and permission issues usually raise Lua errors; catch them with pcall. Operational rejections usually return success=false and a stable error code:

local ok, result_or_error = pcall(afn.pulse, "door", 15, 20)
if not ok then
  printError(result_or_error) -- For example, activation permission is disabled
elseif not result_or_error.success then
  printError(result_or_error.error) -- For example, unknown_channel
end

Common return tables

Action result

{ success=boolean, error=string, active=boolean, strength=number }

set_value/clear_value also return value_present/value_kind/value/revision. On success, error="".

Configuration result

{ success=boolean, error=string, channel=table|nil }

After a successful creation or update, channel is the latest complete snapshot; after a successful deletion, it is nil. Failures never apply partial changes.

Complete snapshot v2

Main fields returned by channels/get:

Field Meaning
id, name, schema_version Stable UUID, name, current schema (2)
receive_enabled, active, strength, displayed Whether wireless reception is allowed, current activation, strength from 0–15, display-list state
primary_frequency Primary frequency; may be empty
secondary_mode none/manual/auth
secondary_frequency Used only by manual mode
value_present Whether a value exists
value_kind, channel_value, value_revision Value tag, actual value, version number
synaxis_activation/receive/publish {enabled,format,x,y}
redstone_bindings Array of {side,strength}; strength may be "all"
last_error Most recent wireless error; normally an empty string

Compatibility fields type/subtype/value/attach_auth/revision remain available. The projection is type="frequency" when the primary frequency is nonempty or no value exists; otherwise, it is type="information". This projection cannot express a channel with both a primary frequency and a value. New code should use the v2 fields.

Channels have no enabled/disabled state. Once created, they can always be activated by redstone, CC:T, and Synaxis to transmit. receive_enabled=false means "send only" and blocks incoming Create wireless signals; true means "allow sending and receiving". Display is also explicitly configured: new channels are displayed by default, and activation does not automatically change the display list.

Exact Lua function index

afn.find

afn.find([bridge_name]) -> raw_bridge, resolved_name

Finds an afn_bridge peripheral; without a name, selects the first one found. Discovery itself does not grant read permission.

-- Success
local raw, name = afn.find()
print(name, type(raw))

-- Failure: the name does not refer to an AFN bridge
local ok, err = pcall(afn.find, "left")
if not ok then printError(err) end

afn.channels

afn.channels([bridge_name]) -> channel_snapshot[]

Returns complete snapshots of all channels in configuration order; requires read permission.

-- Success
for _, c in ipairs(afn.channels()) do print(c.name, c.primary_frequency) end

-- Failure: read permission is disabled
local ok, err = pcall(afn.channels)
if not ok then printError(err) end

afn.active

afn.active([bridge_name]) -> string[]

Returns the names of channels with an effective strength greater than 0, including local and incoming wireless activation; requires read permission.

-- Success
for _, name in ipairs(afn.active()) do print("active", name) end

-- Failure: the specified bridge does not exist
local ok, err = pcall(afn.active, "missing")
if not ok then printError(err) end

afn.display_channels

afn.display_channels([bridge_name]) -> string[]

Returns the current effective display list; requires read permission. Legacy screens use its order; positions on the new tiled screen are determined by screen().placements.

-- Success
print(textutils.serialize(afn.display_channels()))

-- Failure: bridge_name must be a string
local ok, err = pcall(afn.display_channels, 123)
if not ok then printError(err) end

afn.get

afn.get(channel[, bridge_name]) -> channel_snapshot|nil

Returns one complete snapshot; returns nil for an unknown name.

-- Success
local c = assert(afn.get("door"))
print(c.primary_frequency, c.value_present)

-- Failure result: an unknown channel is not an exception
assert(afn.get("missing") == nil)

afn.state

afn.state(channel[, bridge_name]) -> table|nil

Returns {receive_enabled,active,strength,displayed,type,subtype,value_present,value_kind,revision}. receive_enabled=false means send only; type/subtype are legacy projections; an unknown channel returns nil.

-- Success
local s = assert(afn.state("door"))
print(s.active, s.strength, s.value_present)

-- Failure: the computer is not admitted
local ok, err = pcall(afn.state, "door")
if not ok then printError(err) end

afn.value

afn.value(channel[, bridge_name]) -> {present,kind,value,revision}|nil

Returns nil for an unknown channel. A known channel without a value returns {present=false,kind="",value="",revision=tombstone}.

-- Success: the absent-value state can also be distinguished
local v = assert(afn.value("door"))
if v.present then print(v.kind, textutils.serialize(v.value)) else print("no value") end

-- Failure result: unknown channel
assert(afn.value("missing") == nil)

afn.channel_value

An exact alias of afn.value, with the same parameters and return values.

-- Success
local v = assert(afn.channel_value("door"))
print(v.revision)

-- Failure
local ok, err = pcall(afn.channel_value, "door", "missing_bridge")
if not ok then printError(err) end

afn.information (compatibility)

afn.information(channel[, bridge_name]) -> {value,subtype,revision}|nil

afn.information is the compatibility read interface for unified values: it returns an existing value without checking the legacy type; it returns nil when the value is absent or the channel is unknown. New code should use afn.value to distinguish unknown channels from known channels without values.

-- Success: channels with both a primary frequency and a value are readable too
local info = assert(afn.information("door"))
print(info.subtype, info.value)

-- Failure result: nil when no value exists
if afn.information("value_less") == nil then print("no value") end

afn.frequency

afn.frequency(channel[, bridge_name]) -> {primary,secondary_mode,secondary_frequency,attach_auth}|nil

attach_auth is the compatibility boolean projection of secondary_mode=="auth".

-- Success
local f = assert(afn.frequency("door"))
print(f.primary, f.secondary_mode)

-- Failure result
assert(afn.frequency("missing") == nil)

afn.last_error

afn.last_error(channel[, bridge_name]) -> string|nil

Returns the most recent wireless error, such as invalid_frequency_or_auth or wireless_unavailable; returns nil if there is no error or the channel is unknown.

-- Success
local err = afn.last_error("door")
if err then printError(err) end

-- Failure: disabled read permission raises an error
local ok, err2 = pcall(afn.last_error, "door")
if not ok then printError(err2) end

afn.get_display_channel

afn.get_display_channel([bridge_name]) -> string|nil

Returns the current channel in the legacy selected-channel model, or nil when the list is empty. Requires read permission.

-- Success
print(afn.get_display_channel() or "standby")

-- Failure
local ok, err = pcall(afn.get_display_channel, "missing")
if not ok then printError(err) end

afn.set_display_channel

afn.set_display_channel(channel[, bridge_name]) -> boolean

Selects a channel from the current display list without activating it or changing its value. Requires read permission.

-- Success
assert(afn.set_display_channel("door"))

-- Failure result: not in the display list
assert(not afn.set_display_channel("hidden"))

afn.next_display_channel

afn.next_display_channel([bridge_name]) -> string|nil

Switches to the next entry and returns its name; an empty list returns nil.

-- Success
print(afn.next_display_channel() or "standby")

-- Failure
local ok, err = pcall(afn.next_display_channel, false)
if not ok then printError(err) end

afn.previous_display_channel

afn.previous_display_channel([bridge_name]) -> string|nil

Switches to the previous entry and returns its name; an empty list returns nil.

-- Success
print(afn.previous_display_channel() or "standby")

-- Failure
local ok, err = pcall(afn.previous_display_channel, "missing")
if not ok then printError(err) end

afn.set

afn.set(channel[, strength[, bridge_name]]) -> action_result

Creates or replaces a continuous activation lease for the current ComputerID. Strength is 1–15, defaulting to 15; requires activation permission.

-- Success
local r = afn.set("door", 12)
assert(r.success, r.error)

-- Failure result
local bad = afn.set("missing", 15)
print(bad.success, bad.error) -- false unknown_channel

afn.pulse

afn.pulse(channel[, strength[, ticks[, bridge_name]]]) -> action_result

Creates a timed lease lasting 1–1200 ticks. Defaults to strength 15 for 20 ticks.

-- Success
assert(afn.pulse("bell", 15, 40).success)

-- Failure: an out-of-range argument raises an error
local ok, err = pcall(afn.pulse, "bell", 15, 1201)
if not ok then printError(err) end

afn.toggle

afn.toggle(channel[, strength[, bridge_name]]) -> action_result

Toggles only the current ComputerID's continuous lease. It does not clear sources from other computers, redstone, Synaxis, or wireless signals.

-- Success
local r = afn.toggle("maintenance", 8)
print(r.success, r.active)

-- Failure result
local bad = afn.toggle("missing", 8)
print(bad.error) -- unknown_channel

afn.clear

afn.clear(channel[, bridge_name]) -> action_result

Clears the current ComputerID's lease on this channel. It remains available after activation permission is disabled, but the computer must still be admitted; revoking whitelist admission automatically cleans up the lease.

-- Success
assert(afn.clear("door").success)

-- Failure result
local bad = afn.clear("missing")
print(bad.error) -- unknown_channel

afn.clear_all

afn.clear_all(channel[, bridge_name]) -> action_result

Clears all runtime sources on the target channel; requires configuration permission.

-- Success
assert(afn.clear_all("emergency").success)

-- Failure: configuration permission is disabled
local ok, err = pcall(afn.clear_all, "emergency")
if not ok then printError(err) end

afn.set_value

afn.set_value(channel, value[, expected_revision[, bridge_name]]) -> value_action_result

Writes or replaces the unified value according to its Lua type, including creating a value where none exists; does not activate the channel. expected_revision may be omitted.

-- Success: simple overwrite
local r = afn.set_value("door", {12.5, 64, -8})
assert(r.success, r.error)
print(r.value_kind, r.revision)

-- Failure: an invalid array is rejected atomically
local bad = afn.set_value("door", {[1]=1, [3]=3})
print(bad.success, bad.error) -- false invalid_information_value

afn.set_channel_value

An exact alias of afn.set_value.

-- Success
assert(afn.set_channel_value("door", true).success)

-- Failure: stale revision
local bad = afn.set_channel_value("door", false, -1)
print(bad.success, bad.error) -- false revision_conflict

afn.set_information (compatibility)

afn.set_information(channel, value[, expected_revision[, bridge_name]]) -> action_result

afn.set_information is the compatibility write interface for unified values and can create a previously absent value. Its semantics match set_value, but the compatibility raw method returns only the basic action fields. New code should use set_value to receive the value and revision fields.

-- Success
assert(afn.set_information("door", "OPEN").success)

-- Failure result
local bad = afn.set_information("door", 0/0)
print(bad.success, bad.error) -- false invalid_information_value

afn.clear_value

afn.clear_value(channel[, expected_revision[, bridge_name]]) -> value_action_result

Clears to "no value" and advances the tombstone revision if a value actually existed; does not stop activation.

-- Success
local r = afn.clear_value("door")
assert(r.success and not r.value_present, r.error)

-- Failure: concurrent modification conflict
local bad = afn.clear_value("door", -1)
print(bad.success, bad.error) -- false revision_conflict

afn.clear_channel_value

An exact alias of afn.clear_value.

-- Success
assert(afn.clear_channel_value("door").success)

-- Failure result
local bad = afn.clear_channel_value("missing")
print(bad.error) -- unknown_channel

afn.set_primary_frequency

afn.set_primary_frequency(channel, frequency[, bridge_name]) -> configuration_result

Sets the primary frequency. An empty string is valid: it clears the primary frequency and leaves the wireless network without clearing the value or local configuration.

-- Success
assert(afn.set_primary_frequency("door", "factory.door.*").success)

-- Failure result
local bad = afn.set_primary_frequency("door", "broken.[")
print(bad.success, bad.error) -- false invalid_frequency

afn.set_secondary

afn.set_secondary(channel, mode[, frequency[, bridge_name]]) -> configuration_result

mode is none/manual/auth. manual requires a valid frequency; other modes ignore the frequency. auth links only the legacy device credential and cannot create an authentication board or adopt an arbitrary channel's identity. Current real authentication boards are configured in the GUI. Use nil as a placeholder when specifying a named bridge while omitting the frequency.

-- Success
assert(afn.set_secondary("door", "manual", "factory.zone_a").success)
assert(afn.set_secondary("door", "none").success)

-- Failure result
local bad = afn.set_secondary("door", "manual")
print(bad.success, bad.error) -- false invalid_secondary

afn.set_channel_displayed

afn.set_channel_displayed(channel, displayed[, bridge_name]) -> boolean

Changes one channel's display flag; the target must exist. Requires configuration permission. Activation does not automatically change the display flag.

-- Success
assert(afn.set_channel_displayed("door", true))

-- Failure result
assert(not afn.set_channel_displayed("missing", true))

afn.set_display_channels

afn.set_display_channels(channel_names[, bridge_name]) -> boolean

Atomically replaces the display list and its order. The argument must be a contiguous array of existing, unique channel-name strings; an empty array is valid. Unlisted channels are not displayed and are not automatically added when active.

-- Success
assert(afn.set_display_channels({"door", "notice", "boiler"}))

-- Failure result: duplicate name; the old list is retained
assert(not afn.set_display_channels({"door", "door"}))

afn.create_channel

afn.create_channel(definition[, bridge_name]) -> configuration_result

Use v2 fields and omit the legacy type:

Field Required Description
name Yes Unique name, up to 16 characters
primary_frequency Explicit value recommended May be empty; even an empty value explicitly selects the unified definition
secondary_mode No none (default), manual, auth
secondary_frequency In manual mode Ordinary secondary frequency
value_present No Inferred by default from whether channel_value exists
value_kind No text/boolean/real; inferred from the Lua type if omitted
channel_value When value_present=true Actual value
receive_enabled No Defaults to true; false means send only, true allows sending and receiving
displayed No Defaults to true
-- Success: one channel has both a wireless primary frequency and a value
local r = afn.create_channel({
  name = "door",
  primary_frequency = "factory.door",
  secondary_mode = "none",
  value_present = true,
  value_kind = "text",
  channel_value = "CLOSED",
  receive_enabled = true,
  displayed = true
})
assert(r.success, r.error)

-- Failure: manual mode has no ordinary secondary frequency
local bad = afn.create_channel({
  name = "broken", primary_frequency = "factory.broken",
  secondary_mode = "manual"
})
print(bad.success, bad.error)

Legacy fields type/frequency/subtype/value/attach_auth are still accepted for migrating old programs. Do not submit them together with v2 fields that have different meanings; conflicts raise a Lua argument error.

afn.update_channel

afn.update_channel(channel, changes[, bridge_name]) -> configuration_result

Atomically updates the supplied fields, leaving omitted fields unchanged. Recommended fields are name/primary_frequency/secondary_mode/secondary_frequency/value_present/value_kind/channel_value/receive_enabled/displayed. receive_enabled=false only disables incoming wireless signals; it does not disable the channel or stop local transmission. To clear the value, supply only value_present=false; use set_value for value changes sensitive to concurrency.

-- Success
local r = afn.update_channel("door", {
  name = "yard_door",
  primary_frequency = "yard.door",
  channel_value = "READY",
  value_kind = "text"
})
assert(r.success, r.error)

-- Failure: declares no value while supplying one; no changes are applied
local bad = afn.update_channel("yard_door", {
  value_present = false, channel_value = "conflict"
})
print(bad.success, bad.error)

afn.remove_channel

afn.remove_channel(channel[, bridge_name]) -> configuration_result

Deletes a persistent channel and cleans up its leases, wireless actors, and Synaxis endpoints. On success, channel=nil.

-- Success
local r = afn.remove_channel("temporary_channel")
assert(r.success and r.channel == nil, r.error)

-- Failure result
local bad = afn.remove_channel("missing")
print(bad.error) -- unknown_channel

afn.set_channel_type (deprecated compatibility)

afn.set_channel_type(channel, legacy_type[, replacement[, bridge_name]])
  -> configuration_result

frequency/information are compatibility projections only; they do not represent the current storage model:

  • frequency only ensures that a primary frequency exists. If supplied, replacement must be a valid primary frequency; the existing value is retained.
  • information only ensures that a value exists and clears the primary/secondary frequencies. If supplied, replacement is parsed using the current value tag.

New programs should use set_primary_frequency, set_secondary, set_value, and clear_value to modify the independent fields explicitly.

-- Compatibility success: existing values are retained
local r = afn.set_channel_type("door", "frequency", "factory.door")
assert(r.success, r.error)

-- Failure: neither a primary frequency nor replacement exists
local bad = afn.set_channel_type("value_only", "frequency")
print(bad.success, bad.error)

afn.set_information_subtype (deprecated compatibility)

afn.set_information_subtype(channel, subtype[, replacement[, bridge_name]])
  -> configuration_result

Legacy value-tag conversion interface. Newly created values can use only real/text/boolean; changing the type usually also requires a compatible replacement. New programs should call set_value directly; its Lua type determines the tag.

-- Compatibility success
assert(afn.set_information_subtype("door", "boolean", true).success)

-- Failure: coordinate/player are read-only
local bad = afn.set_information_subtype("door", "coordinate", {0, 64, 0})
print(bad.success, bad.error) -- information_subtype_read_only

afn.set_synaxis_activation

afn.set_synaxis_activation(channel, enabled[, format[, x, y[, bridge_name]]])
  -> configuration_result

Configures the independent Synaxis → bridge activation input. Only real/boolean formats are allowed; omitting format or passing an empty string retains the current format. x and y must be supplied together and must both be within 0–112. Explicitly calling this function, even to disable the input, exits the legacy migration semantics in which a value port also activates the channel.

-- Success
local r = afn.set_synaxis_activation("door", true, "real", 24, 60)
assert(r.success, r.error)

-- Failure result: the activation port does not support vec3
local bad = afn.set_synaxis_activation("door", true, "vec3")
print(bad.success, bad.error) -- unsupported_synaxis_activation_format

afn.set_synaxis_receive

afn.set_synaxis_receive(channel, enabled[, format[, x, y[, bridge_name]]])
  -> configuration_result

Configures the Synaxis → bridge value input, which writes values without activating the channel. Supported formats are real/boolean/vec3/quaternion; omitting the format retains the current format. Short arrays overwrite the leading elements and retain the old tail; longer arrays extend the value. An invalid frame leaves the old value unchanged.

-- Success
assert(afn.set_synaxis_receive("pose", true, "vec3", 20, 70).success)

-- Failure result: coordinates must be paired and within range
local bad = afn.set_synaxis_receive("pose", true, "vec3", 200, 70)
print(bad.success, bad.error) -- invalid_synaxis_position

afn.set_synaxis_publish

afn.set_synaxis_publish(channel, enabled[, format[, x, y[, bridge_name]]])
  -> configuration_result

Configures the bridge → Synaxis value output, which publishes values without activating the channel. Failed conversions output schema-safe defaults: false, 0, or all-zero arrays; Quaternion fills a missing w with 1.

-- Success
assert(afn.set_synaxis_publish("pose", true, "quaternion", 88, 70).success)

-- Failure result: new Pose/Twist ports cannot be created
local bad = afn.set_synaxis_publish("pose", true, "pose")
print(bad.success, bad.error) -- unsupported_synaxis_format

The three directions together allow at most 32 Synaxis ports per bridge. Enabling only value input/output does not count as activation; a Synaxis activation lease is created only when the activation port receives a valid Real/Boolean.

afn.bind_redstone

afn.bind_redstone(channel, side, strength[, bridge_name])
  -> configuration_result

side is front/back/left/right/up/down/all, relative to the front of the screen; strength is 1–15 or the string "all". The same input may be bound to multiple channels; an identical combination is idempotent.

-- Success: any direction and any nonzero strength
assert(afn.bind_redstone("door", "all", "all").success)

-- Failure: invalid direction
local bad = afn.bind_redstone("door", "north", 15)
print(bad.success, bad.error) -- invalid_redstone_binding

afn.unbind_redstone

afn.unbind_redstone(channel, side[, bridge_name]) -> configuration_result

Deletes all strength rows under this exact side selector. "all" deletes only omnidirectional rows, leaving the six specific directions untouched.

-- Success
assert(afn.unbind_redstone("door", "front").success)

-- Failure result
local bad = afn.unbind_redstone("door", "north")
print(bad.success, bad.error) -- invalid_redstone_binding

afn.transmit_temporary

afn.transmit_temporary(frequency[, strength[, attach_auth[, bridge_name]]])
  -> {success,error,active,strength,handle}

Creates a continuous wireless transmission that does not belong to a persistent channel, defaulting to strength 15. Temporary APIs transmit only strength, without carrying any channel value. attach_auth=true depends on the legacy linked device authentication credential; without it, the result is auth_board_unavailable. It does not select or fabricate an identity from current channel frequency slots. To send on a current authenticated channel, configure the real boards in the GUI first, then call set/pulse.

-- Success
local tx = afn.transmit_temporary("factory.alarm", 12, false)
assert(tx.success, tx.error)
print(tx.handle)

-- Failure result: invalid frequency
local bad = afn.transmit_temporary("broken.[")
print(bad.success, bad.error)

afn.pulse_temporary

afn.pulse_temporary(frequency[, strength[, ticks[, attach_auth[, bridge_name]]]])
  -> {success,error,active,strength,handle}

Creates a temporary wireless transmission lasting 1–1200 ticks; defaults to strength 15 for 20 ticks.

-- Success
local tx = afn.pulse_temporary("station.bell", 15, 40, false)
assert(tx.success, tx.error)

-- Failure: an out-of-range argument raises an error
local ok, err = pcall(afn.pulse_temporary, "station.bell", 15, 1201)
if not ok then printError(err) end

afn.clear_temporary

afn.clear_temporary(handle[, bridge_name]) -> action_result

Stops one temporary transmission owned by the current ComputerID. Cleanup remains available when activation permission is disabled, but the computer must still be admitted.

-- Success
local tx = assert(afn.transmit_temporary("factory.alarm"))
assert(afn.clear_temporary(tx.handle).success)

-- Failure result
local bad = afn.clear_temporary("missing-handle")
print(bad.success, bad.error) -- unknown_temporary_handle

afn.clear_temporary_all

afn.clear_temporary_all([bridge_name]) -> integer

Stops all temporary transmissions belonging to the current ComputerID and returns the number removed.

-- Success
print("removed", afn.clear_temporary_all())

-- Failure: rejected whitelist admission raises an error; revocation itself cleans up automatically
local ok, err = pcall(afn.clear_temporary_all)
if not ok then printError(err) end

Tiled screen and interaction configuration

The current bridge screen can be tiled horizontally and vertically, without the legacy large CRT device. Create channels in the GUI or with create_channel, then configure regions and display settings. Layout APIs use block units. An individual region no longer has the old 4×4 limit, but it must stay within the actual screen rectangle and must not overlap other regions.

afn.screen([bridge_name]) / raw getScreen()

Requires read permission. Returns {adaptive,width,height,enabled,interaction_locked,revision,placements}. width/height are the whole screen's dimensions in blocks; revision is the configuration version, not the value version. Each region contains {channel,channel_id,x,y,width,height}, with coordinates starting at 0,0 in the top left.

afn.set_screen(changes[, bridge_name]) / raw setScreen(changes)

Requires configuration permission. Can change enabled, interaction_locked, and placements; may include expected_revision=afn.screen().revision to avoid overwriting other configuration changes. Omitted fields remain unchanged. placements replaces the entire layout; an empty array clears it. Entries identify channels by channel or channel_id; if both are given, they must identify the same channel. Each channel can have at most one region. A region may use any positive integer width and height within the connected bridge screen's bounds, but cannot overlap or extend outside them. Rectangular layouts are supported only on tiled bridges.

Returns {success,error,screen}; failure leaves the original configuration unchanged. Turning off the screen or locking interaction does not stop wireless channels.

local afn = require("afn")
local screen = afn.screen()
assert(screen.width >= 2 and screen.height >= 2, "A screen of at least 2×2 is required")
local result = afn.set_screen({
  expected_revision = screen.revision,
  placements = {{channel="库存", x=0, y=0, width=2, height=2}}
})
assert(result.success, result.error)

afn.display(channel[, bridge_name]) / raw getChannelDisplay(channel)

Requires read permission. Returns this channel's screen configuration, or nil for an unknown channel. Reads use only immutable snapshots published by the server; they do not wait for task_complete or consume timer events.

afn.set_display(channel, changes[, bridge_name]) / raw setChannelDisplay(channel, changes)

Requires configuration permission. Changes only the supplied fields; may include expected_revision=afn.screen().revision. Returns {success,error,display}. Failures never apply partial changes. This does not change raw channel content or open a player confirmation dialog. Unknown fields, incorrect types, nonfinite numbers, and out-of-range values are rejected.

Field Format and effect
mode default/switch/bar/gauge/map/logistics/stock/dialogue. Horizontal bars use bar_horizontal=true, rather than a separate mode
activation_condition Condition string, up to 1024 code points / 4096 UTF-8 bytes; an empty string disables it. Supports output syntax references and functions, comparisons, and logical operations. Continuously activates while true, without rewriting the channel value
output_signal_strength Numeric string or output syntax, up to 1024 code points / 4096 UTF-8 bytes, such as "8", "${库存[0]}", or "${strength($.传感器)}". A number or single-element numeric array result is clamped to 0–15, with fractions rounded down; missing values or errors output 0. When set, overrides local activation output without changing incoming wireless strength; directly or indirectly reading its own strength is prohibited. An empty string follows the triggering source's strength; automatic activation without an external strength source defaults to 15
show_name / show_idle boolean; controls the channel title and idle state respectively
dialogue_show_avatar / dialogue_show_name boolean; dialogue message avatars and sender names, shown by default
dialogue_latest_only boolean; true shows only the latest message, false shows a history list that can be scrolled directly with the mouse wheel; the message body is always shown. The legacy key dialogue_show_message is a synonymous compatibility alias; if both keys are supplied, their values must agree
dialogue_replies String array of simple dialogue replies; shares storage with presets, so both cannot be supplied in the same update
dialogue_send_avatar / dialogue_send_name string; avatar/name used when the bridge sends a reply. The avatar may be item:minecraft:apple or player:UUID; empty values use anonymous identity without inferring a player
dialogue_allow_clear boolean; enables a clear button on the dialogue screen that clears both history and the channel value; interaction permissions still apply
display_output_syntax boolean; displays the evaluated result of the channel's output syntax. Enabling it disables screen interaction; the calculated result cannot be treated as an editable raw value
interaction_enabled / change_confirmation boolean; controls whether players can interact and whether value changes require confirmation; does not restrict CC value writes
integer_adjustment / sensitivity boolean / positive finite number; preferences for adjusting numbers on the screen
charset Nonempty string, up to 32 characters; character set for screen text adjustment
minimum / maximum Finite lower/upper bounds. Bar charts and gauges require the minimum to be less than the maximum; a legacy unbounded range is automatically set to 0–15 when entering a chart mode
bar_horizontal boolean; horizontal bar chart
chart_components Contiguous array of up to 8 {name,minimum,maximum} entries; used by bar charts, gauges, and array switches. Names are limited to 16 characters. Omitted bounds use the effective channel range; switches use 0–1 for legacy unbounded ranges
presets String array of up to 32 entries; used for default-mode options, logistics supply groups, or simple dialogue replies. Each entry is limited to 1024 code points, with a total limit of 8192 code points
control_color / background_color / other_color Integer RGB, such as 0x88CC66; -1 restores the default. Controls widgets, the screen background, and foreground elements such as text, numbers, and gauge needles, respectively
control_palette / background_palette Built-in palette number 0–3; an RGB color takes precedence when set
map_source auto/xaero/afn/grid; auto selects Xaero→AFN→grid in that order. Terrain sources are resolved on the client; the server does not need Xaero installed
map_show_connection / map_show_distance / map_show_coordinates boolean; controls the connecting line, distance, and coordinates independently; shown by default
map_background_hidden boolean; displays only map overlays without drawing terrain
map_dynamic_rotation boolean; follows the rotation of the Sable physical structure carrying the bridge, off by default; map_rotation corrects the orientation
map_zoom / map_rotation Integers -4–10 / 0–3; each rotation unit is 90° clockwise
map_world_span 0–120000000; base world span along the map's shorter edge; 0 means not yet initialized
map_center {x=...,z=...} sets the pan center; false clears the retained center. Moves only the view, without writing target coordinates
map_favorites Up to 16 {name,x,y,z,custom_name} entries; name may be omitted for automatic naming, and custom_name is optional. Coordinates must not be duplicated

The map configuration GUI offers "Dynamic mode" to rotate the map with the Sable physical structure carrying the bridge. "Rotate map" corrects the orientation. Dynamic mode is off by default.

Activation conditions reference channels on this bridge, for example ${温度} ≥ 30 & ${开关} = true or ${number($.温度)} > 25 || ${模式} = "手动". Self-references read the raw value; references to other channels read their effective output. Single-element arrays can be compared directly; arrays with multiple elements require selection or aggregation. Supported operators are = / ==, !=, <, >, >= / ≥, <= / ≤, & / &&, ||, and parentheses, with precedence in this order: parentheses, comparison, AND, OR. A true condition activates continuously; an empty output-strength setting defaults to 15. If a strength expression is set, its result determines the output. False conditions, missing values, or errors release the condition source without affecting other sources. An empty condition disables it. Checks run within budget only when referenced data changes. The GUI, .bridge files, and set_display share this configuration; a syntax error rejects the entire save.

In output syntax, add(a,b,...) accepts two or more arguments, up to 8 by default; sub, mul, and div remain binary. Scalar functions accept single-value channels and one-item JSON arrays without [0]: ${add($.Fuel1,$.Fuel2,$.Fuel3)}, ${number($.Stock)} and ${text($)}. Existing indices remain valid. Scalar contexts unwrap one array level; larger arrays need selection or aggregation. Structural and collection functions retain arrays. Numeric text still needs number() to extract its first numeric fragment, ignoring surrounding text and grouping commas. For example, 1,234,211 su produces 1234211; when text contains multiple numbers, only the first is extracted.

if(test,yes,no) requires a boolean condition and evaluates only the selected branch; a missing condition is treated as false. switch(value,match,result,...[,default]) uses strict type matching and returns the first matching result, with an optional final default value. Match values must be scalar JSON literals; no match without a default returns missing. Both functions retain channel dependencies from all branches, but access only the selected result at runtime.

To prevent feedback on the same frequency, other channels referenced by a condition, and their output dependencies, must not receive the condition channel's output frequency. References to its own raw value are allowed.

map_* fields can be changed only in map mode. Text options can still write values through set_value; array switches use chart_components to name elements in the group. Each logistics-mode presets entry can contain a dispatch statement supported by the receiver, or a single-line JSON definition of a named supply group:

local afn = require("afn")
assert(afn.set_display("库存", {
  mode="stock", show_name=false, show_idle=false,
  control_color=0xD8E7CE, background_color=0x17251B
}).success)

local group = textutils.serializeJSON({name="苹果配送", items={
  {item="minecraft:apple", count=8, address="餐厅"}
}})
assert(afn.set_display("配送", {mode="logistics", presets={group}}).success)

assert(afn.set_display("导航", {mode="map", map_source="xaero",
  map_show_connection=false, map_show_distance=true}).success)

The logistics screen sends after a player selects a supply group. For active CC dispatch, continue to write a valid statement with set_value, then activate it with pulse; configuring supply groups alone does not place an order. The stock view parses stock mailbox output and shows only item icons and quantities. The map wheel zooms around the focus, and the middle mouse button only pans. After right-clicking a point or an external ordinary/long signal updates it to different valid coordinates, the view automatically fits only if either point is outside the view; if both are visible, the view stays unchanged. While a map is displayed, horizontal device movement also triggers low-frequency checks: the view is retained if both points are visible and fits only when either point goes outside. No movement means no fitting; middle-button dragging and drafts awaiting confirmation take priority. Identical data and CC writes do not trigger automatic following. When confirmation is enabled, drafts retain the original view; whether to fit is checked only after successful confirmation. Wireless fitting during editing is deferred until the draft ends.

get_display_channel/set_display_channel/next_display_channel/previous_display_channel retain the legacy selected-channel semantics and do not move regions on a tiled screen. set_display_channels/set_channel_displayed control display eligibility without automatically allocating rectangles. New programs should configure placements explicitly.

Dialogue screen example

First create a 消息 channel in the GUI, then configure its display and replies. dialogue_latest_only=false shows the history list; true shows only the latest message. Disabling interaction also prevents players from scrolling history.

local afn = require("afn")
assert(afn.set_display("消息", {
  mode="dialogue", show_name=false, show_idle=false,
  dialogue_show_avatar=true, dialogue_show_name=true,
  dialogue_latest_only=false,
  dialogue_send_avatar="item:minecraft:paper",
  dialogue_send_name="服务台", dialogue_allow_clear=true,
  dialogue_replies={"收到", "请稍候"}
}).success)

local message = textutils.serializeJSON({
  avatar="item:minecraft:apple", name="仓库",
  messages={"到货:", {["minecraft:apple"]=8}, "请查收"}
})
assert(afn.set_value("消息", message).success)
assert(afn.pulse("消息").success)

messages can mix text with multiple stock objects, arranging item entries as icon/count emotes. Plain text without a chat JSON wrapper is interpreted as an anonymous message.

Physical map buttons, the GUI's "Activate immediately after modification", and .bridge import/export do not imply the existence of Lua fields with the same names. The table above defines the current valid set_display fields. Unknown fields reject the entire update; GUI labels cannot be used directly as API keys.

CC events

Connected computers with read permission can listen for:

Event Parameter 2 (payload)
afn_channel_started {channel,type,active=true,strength}
afn_channel_stopped {channel,type,active=false,strength=0}
afn_channel_changed Strength changes while active
afn_channel_value_changed Adds revision,value_present,value_kind,channel_value
afn_information_changed Legacy compatibility alias of the preceding event
afn_display_changed {channel}; an empty string means no selection
afn_channel_timeout A channel or temporary transmission expires; temporary payloads include operation,handle,active=false
afn_channel_rejected The current computer's action is rejected; includes operation,error and optional channel

Lua module constants:

local afn = require("afn")
print(afn.CHANNEL_VALUE_CHANGED)       -- afn_channel_value_changed
print(afn.LEGACY_INFORMATION_CHANGED) -- afn_information_changed

while true do
  local _, event = os.pullEvent(afn.CHANNEL_VALUE_CHANGED)
  print(event.channel, event.value_present, event.revision)
end

Events are bounded, deduplicated state notifications rather than an unlimited message queue. Starting to listen does not replay all historical state, and a total per-tick budget applies. To obtain authoritative current state, call afn.get/value after receiving an event.

Raw afn_bridge peripheral methods

require("afn") is a convenience wrapper around the raw peripheral. The channel enable/disable API has been removed. Current raw dynamic method indices are 0–42; screen methods are appended at the end, leaving the names and parameters at indices 0–38 unchanged. The p used below is:

local p = peripheral.find("afn_bridge")
assert(p, "no AFN bridge")

Where "failure" in the table says nil/false, it means a normal failure result. Argument or permission errors can still be raised; use pcall.

Index Raw method and parameters Returns Short success / failure examples
0 listChannels() Snapshot array #p.listChannels(); raises an error without read permission
1 listActiveChannels() Name array p.listActiveChannels(); raises an error without read permission
2 listDisplayChannels() Name array p.listDisplayChannels(); raises an error without read permission
3 getChannel(channel) Snapshot or nil p.getChannel("door"); unknown name→nil
4 getState(channel) Compact state or nil p.getState("door"); unknown name→nil
5 getInformation(channel) Legacy value table or nil Value exists→table; absent/unknown→nil
6 getLastError(channel) string or nil No wireless error→nil; raises an error without read permission
7 getDisplayChannel() Name or nil Selected entry→string; empty list→nil
8 setDisplayChannel(channel) boolean Displayable→true; hidden/unknown→false
9 nextDisplayChannel() Name or nil Successful switch→string; empty list→nil
10 previousDisplayChannel() Name or nil Successful switch→string; empty list→nil
11 set(channel[,strength]) Action result p.set("door",15); unknown→success=false
12 pulse(channel[,strength[,ticks]]) Action result p.pulse("door",15,20); ticks>1200 raises an error
13 toggle(channel[,strength]) Action result p.toggle("door",8); unknown→failure table
14 clear(channel) Action result Clear own source→success; unknown→failure table
15 clearAll(channel) Action result Clear all sources→success; raises an error without configuration permission
16 setInformation(channel,value[,revision]) Basic action result Can write a previously absent value; stale revision→failure table
17 setChannelDisplayed(channel,boolean) boolean Known target→true; unknown→false
18 setDisplayChannels(names) boolean Valid contiguous array→true; duplicate/unknown→false
19 createChannel(definition) Configuration result Valid v2 table→success; invalid definition→failure table
20 updateChannel(channel,changes) Configuration result Atomic update→success; unknown→failure table
21 removeChannel(channel) Configuration result Deletion→channel=nil; unknown→failure table
22 setChannelType(channel,type[,replacement]) Configuration result Legacy compatibility intent; missing required replacement→failure
23 setInformationSubtype(channel,subtype[,replacement]) Configuration result Legacy compatibility conversion; read-only tag→failure
24 setSynaxisReceive(channel,enabled[,format[,x,y]]) Configuration result Valid value input port→success; invalid coordinates→failure
25 setSynaxisPublish(channel,enabled[,format[,x,y]]) Configuration result Valid value output port→success; legacy Pose/Twist→failure
26 bindRedstone(channel,side,strength) Configuration result "all","all"→success; invalid direction raises an error or returns failure
27 unbindRedstone(channel,side) Configuration result Valid selector→success; invalid direction→failure
28 transmit(frequency[,strength[,attach_auth]]) Temporary result Success includes handle; invalid frequency→failure table
29 pulseTemporary(frequency[,strength[,ticks[,attach_auth]]]) Temporary result Success includes handle; out-of-range timeout raises an error
30 clearTemporary(handle) Action result Own handle→success; unknown→failure table
31 clearTemporaryAll() Number removed Returns 0..32; raises an error if not admitted
32 getChannelValue(channel) {present,kind,value,revision} or nil Known channel without a value still returns a table; unknown→nil
33 setChannelValue(channel,value[,revision]) Action result with value fields Valid type→success; invalid value/conflict→failure
34 clearChannelValue(channel[,revision]) Action result with value fields Clear to absent→success; stale revision→failure
35 getFrequency(channel) Primary/secondary frequency table or nil Known→table; unknown→nil
36 setPrimaryFrequency(channel,frequency) Configuration result Empty string can clear it; invalid expression→failure
37 setSecondary(channel,mode[,frequency]) Configuration result none/auth or manual+frequency→success; invalid→failure
38 setSynaxisActivation(channel,enabled[,format[,x,y]]) Configuration result real/boolean→success; vec3 etc.→failure
39 getScreen() Screen state Includes dimensions, configuration revision, and placements; requires read permission
40 setScreen(changes) {success,error,screen} Valid layout→success; overlapping/out of bounds→failure
41 getChannelDisplay(channel) Screen configuration or nil Known channel→table; unknown→nil
42 setChannelDisplay(channel,changes) {success,error,display} Atomic update; invalid field/out of range→failure

Raw methods do not have the wrapper's final bridge_name argument, because p already represents a specific peripheral.

Compatibility migration

  • Raw indices are 0–42. New screen methods are appended after the existing 0–38, preserving compatibility with function names and parameters in older scripts.
  • createChannel/updateChannel use receive_enabled to switch between "send only" and "allow sending and receiving"; there is no separate enabled state.
  • afn.information/set_information remain available and now map to unified optional values; value/set_value/clear_value are recommended.
  • set_channel_type/set_information_subtype remain available but are deprecated. They express only legacy intent and cannot restore the mutually exclusive storage model.
  • Snapshots retain type/subtype/value/attach_auth/revision, but new programs should read schema_version=2 and the independent v2 fields.
  • afn_information_changed is sent alongside the new afn_channel_value_changed, allowing existing listeners to keep working.
  • Saved legacy semantics in which a Synaxis value port also activates the channel are retained until a player or CC explicitly uses the new activation-port settings. Explicitly enabling or disabling activation both complete this migration.

Common error codes

Error code Meaning
unknown_channel The channel name does not exist; do not use the primary frequency as the channel name
revision_conflict The value has changed; read it again before recalculating
information_write_conflict A higher-priority source has already written in the same tick
invalid_information_value Invalid type, length, finite-number requirement, or array structure
information_subtype_read_only Legacy coordinate/player values cannot be modified
invalid_frequency Invalid primary frequency expression
invalid_secondary Invalid secondary mode or manual frequency
invalid_synaxis_position x/y are not paired or are outside 0–112
unsupported_synaxis_format The value port requests a format that cannot be newly created
unsupported_synaxis_activation_format The activation port is not real/boolean
synaxis_port_limit The combined total of the three port types has reached 32
channel_limit The bridge has reached 64 channels
runtime_source_limit A single channel has reached 256 runtime sources
invalid_frequency_or_auth Wireless primary/secondary frequencies or the authentication link are currently invalid
frequency_board_permission_denied The current computer cannot replace/remove a real authentication board; an authorized player must edit it
auth_board_unavailable Temporary attach_auth has no available legacy device credential; send through a channel configured in the GUI
wireless_unavailable The Create wireless runtime is currently unavailable
invalid_screen_configuration Invalid screen field, type, numeric range, or array structure
invalid_screen_layout Duplicate, overlapping, out-of-bounds, or incorrectly sized rectangles
screen_layout_requires_adaptive_bridge Legacy bridges do not support tiled rectangular layouts

Permission errors usually raise readable Lua text directly, such as computer read access is disabled..., rather than returning an error code from the table above.

Frequency expression quick reference

Primary and manual secondary frequencies use AFN transmitter expressions: ? matches one character, * matches arbitrary text within one layer, ** matches across layers, [A-C] is a character set, and positive.!exclude!exclude applies multiple exclusions within the current layer. Receiver addresses remain literal. For complete rules and copyable examples, see AFN WIKI and the Chinese overview.

17
BEFORE YOU GO

Compatibility and FAQ

Which mods integrate with AFN, and what versions are needed?+

AFN 1.9.3 requires Minecraft 1.21.1, NeoForge 21.1.218+, Java 21. “Optional” below means install as needed; AFN's core features work without those mods.

ModRequirementIntegration and version conditions
CreateRequired6.0.0+; provides the redstone network, logistics, displays and device foundations.
CC:TweakedOptional1.118 ≤ version < 2; bridge peripheral and afn Lua API.
DashpanelsOptional2.1+; AFN control, display, map and radar panel modules.
SynaxisOptionalCimulink activation, value-input and value-output ports. AFN sets no minimum or maximum runtime version.
CreateImproveOptional1.4.0+ enables AFN integration: text frequency links and signal routers.
Create: Flight ControlOptional0.8.3+ enables integration: flight-control parameters and navigation terminal data.
Create: ConnectedOptionalWrite parameters to clutches, kinetic batteries, kinetic bridges and related devices.
Create Crafts & AdditionsOptionalControl Electric Motor speed and direction; read exact Accumulator energy, capacity, remaining capacity, percentage and progress bars.
Create Diesel GeneratorsOptionalEngine/device state and fuel readings; engine direction, Chemical Turret aiming/spraying, Burner valve opening and Pumpjack Crank size.
Create: Electro EnergeticsOptionalRead electrical measurements and component settings; control motor speed, resistance, capacitance, inductance, voltage, transformer ratio and winding turns.
Create Propulsion: SimulatedOptionalRead thrusters, transmissions, tilt adapters, Stirling Engines, and Coral Generators. Control throttle, vector deflection, and transmission mode.
Create: RadarOptional5.0.0+ enables radar contacts, targets, fire-control and warning readings; controller angles, targets, installed filters, safe zones, jammers and structure identity settings.
Create Big CannonsOptionalRead data, adjust angles, aim and fire with Cannon Mounts and Fixed Cannon Mounts.
NetMusicOptionalRead record-player state, songs and lyrics; read and control broadcasts on speakers.
Create: AeronauticsOptionalReadings and parameter configuration for navigation tables, sensors, propeller bearings, Hot Air Burners and Steam Vents; Wheel Mount suspension-strength configuration.
SableOptionalMoving-structure coordinates, terminals following structures, and long-signal keepalive for Aeronautics structures. The long-signal notes include large-structure limits.
Sable Photomancy / Sable Schematic APIOptionalIntegrates schematic capture, editing and construction when sable_schematic_api is provided.
Xaero's World MapOptional · ClientMap terrain source; not required on the server.
Touhou Little Maid: Butler (SFN)Optional add-onUses the AFN API for maid butlers, channels and logistics dispatch. Its current dependency declares AFN 1.2.1+, Touhou Little Maid 1.5.2+.

Integration without a listed version threshold detects available interfaces; this does not mean every version is verified. Check each mod's download page for its own dependencies and compatible versions.

How do I connect another mod to the AFN channel system?+

Visit the GitHub API directory, open create_afn-channel-api.jar and click Download raw file to download. The directory also includes Javadoc and integration examples.

Follow the SDK quick start using compileOnly and only the com.createafn.api.channel public interfaces. The current SDK requires AFN 1.1.6+; the Channel API version is 1.1. Install full AFN at runtime. The API JAR is for development only; add-ons must not bundle its classes.

Where is AFN heading?+

AFN aims to connect everything: let devices from different mods share data, respond to commands and become a smart system built by the player.

We will keep integrating more mods and opening up integration capabilities. AFN strengthens connections from within, while other mod authors extend the channel system through the API. Together, we can bring more devices online, keep data flowing and take players' ideas further!

Where can we discuss AFN?+

The WIKI may open a community group later, depending on circumstances.

Connect more devices

Start with a Frequency Board, and let data flow between devices.

Back to the first step ↑

Search AFN WIKI

Chapters, devices and functions in one search.