Extensions API
Some of the Perception.cx AngelScript APIs are available in extensions. This includes: logging, rendering, input, CPU intrinsics, WinAPI, JSON, utilities, and Zydis encoding. Not available: process memory (
proc_t/ref_process), networking (c_net/ws_t), mutexes, PCX script GUI API (subtab_t/panel_t/checkbox_t/slider_double_t/button_t/etc.), filesystem API, Unicorn emulation, extended math, engine-specific API, atomic API, andregister_callback/unregister_callback. Extensions additionally get editor-specific APIs documented below.
Available platform functions: log, log_error, log_console, log_console_error, get_username, all draw_* / clip_* / create_font* / create_bitmap / get_font* / get_text_size rendering functions, all key_* / get_mouse_* / get_scroll_delta / is_hovered input functions, CPU intrinsics, WinAPI, JSON (json_parse/json_stringify), Zydis encoder, and utility functions.
AngelScript string note: Extensions use the standard AngelScript
stringtype. Use.isEmpty()(not.empty()),.length()(not.size()), and.findFirst()/.findLast()for search.
Structure
One .as file per extension. Drop it in <scripting_main_path>/extensions/. Three optional metadata constants:
const string EXT_NAME = "My Extension";
const string EXT_VERSION = "1.0";
const string EXT_DESCRIPTION = "Short description";All hook functions are optional — implement only what you need.
Rules & Constraints
No
main()oron_unload()— useon_activate()andon_deactivate()insteadon_tick()locals reset every call — use global variables for persistent state across framesNo lambdas — buttons return
bool, useif (create_button("X")) { ... }instead of callbacksOnly
create_slider— nocreate_slider_doubleorcreate_slider_intvariantson_settings_renderuses widget API only — do NOT usedraw_*render calls inside it. The widget functions handle all rendering and layout automaticallyRGBA values are 0–255 — not 0.0–1.0
Keybinds and color pickers must be created immediately after their parent checkbox
Validation
Extension scripts can be validated using check_script / validate_script or the Verify toolbar button. The editor automatically detects files in extensions/ and uses a dedicated compile-only validator with the extension API surface registered.
validate_scriptwithrun=trueis not supported for extensions — they are event-driven with nomain()execute_scriptcannot be used with extension code — extensions use a different API surfaceAfter validation returns PASS, the extension is correct and will be auto-loaded by the editor
Hooks
Lifecycle
Editor Events
AI Pipeline
IntelliSense
Extensions can provide completions and hover tooltips for any file type — not just AngelScript or Lua. The extension receives the file path, line text, and cursor column, and decides what to offer based on the file being edited. This means you can build HTML, CSS, Python, or any custom language IntelliSense via extensions.
Settings UI
Editor API
Settings API
Persisted per-extension as JSON in the extensions/ folder (e.g. extensions/my_extension.json). Settings survive editor restarts, extension reloads, and ON/OFF toggles. The enabled/disabled state of each extension is also persisted in the editor's workspace state.
Widget API
Used inside on_settings_render to draw interactive UI.
Tool Registration API
Register custom AI tools. Only your extension can handle calls to tools it registered.
Examples
Custom AI Tool
Widget Settings Panel
IntelliSense Provider
AI System Prompt Injection
Periodic Background Worker
Last updated