Sharp Aion2 Lua SDK
Guides

Example scripts

Choose a starter for your own Lua script.

Use Download example scripts in the Scripts tab to install the examples. Downloading does not run a script. Some examples need a logged-in character or an available game object.

Find a starting point

What you are buildingStart hereRelated reference
A one-time checkhello.luaLogging, game
A nearby actor browsernearby_entitiesEntities helpers
A foreground overlaymob_overlayDrawing
A configurable windowui_showcaseUI SDK, hotkeys
A price or results chartcharts_demoCharts, Chart helpers
A response to watched skillsblock_skillAuto Defense
A periodically refreshed quest listQuest journalQuests
A user-triggered movement requestTravel helperMovement
A pet and its confirmed soul sourcesPet catalogGame data

Instant scripts

File under examples/instant/What it shows
hello.luaLogging and a minimal one-shot.
nearby_mobs.luaNearby entity enumeration.
map_reveal.luaOne-time reveal of the currently open world map. Open the map first, then press Run once.

Persistent modules

File under examples/modules/<id>/main.luaWhat it shows
ui_showcaseInteractive window, colors, button, checkbox, slider, input, HUD text, and F6 toggle.
charts_demoLine and bar charts with hover values, using synthetic data. Requires a chart-enabled loaded DLL; older clients show a capability message.
nearby_entitiesSearchable, paged entity list with refresh and filtering.
mob_overlaySimple foreground overlay from actor records.
block_skillOne Auto Defense watch and configured response.

For a script of your own, start with Quickstart, copy the closest example into a new ID, then look up each call in the API reference. Check nil, error results and read game values again after a map or character change.

The quest journal and configurable travel helper are complete module examples you can save directly into your Scripts folder.

Static catalog example

The game data catalogs are dated client definitions, not live game state. Each catalog loads on its first accessor call and stays cached for the rest of the script. This example lists the NPCs whose client loot table names one specific pet soul item, together with the pet it belongs to. It does not report which pets your character owns or how far a pet has been raised.

local sdk = require("sdk")
local pets = sdk.data.pets()
local npcs = sdk.data.npcs()

local lines = {}
for npcId, npc in pairs(npcs) do
    if npc.pet_id and npc.pet_soul_item_id then
        local pet = pets.pets[npc.pet_id]
        lines[#lines + 1] = string.format("%s (#%d) -> %s, soul item #%d",
            npc.name, npcId, pet and pet.name or "?", npc.pet_soul_item_id)
    end
end

table.sort(lines)
for _, line in ipairs(lines) do
    log.info(line)
end

Script Store examples

These examples are separate Store downloads. Open Scripts → Script Store, search the exact title, download the module, then select Load. Open the main menu to interact with its window. Their packages include their libraries privately, so they do not replace your edited shared libraries.

Store titleWhat it doesDownload
Auto ChatTimed messages and keyword replies, player channels, optional AI writing, previews and saved setup. Starts paused.Module ZIP
Character DashboardRefreshes name, level, class code, map, displayed HP/MP, position, and actor time scale twice per second. Includes an optional compact HUD.Module ZIP
Waypoint NotebookSaves up to 64 named positions across module reloads. Select a point to show its label while on the matching map.Module ZIP
Game SDK InspectorShows named Actor or Character member values once per second and displays a declared game method without calling it.Module ZIP

Auto Chat

Use Overview to add your first message or reply. Messages holds wording, channel and interval; Replies holds the keyword, listening channel and reply destination. Replies can stay in the incoming channel, Whisper its author or use a fixed channel. Preview a keyword rule before enabling it.

Select recent players for Whisper recipients, or enter their exact IDs in advanced settings. Use Timing for message spacing and reply cooldowns, then Save setup. Select Start automation when ready; Pause automation is always visible. Activity shows recent requests and errors. Loading or saving the module leaves it paused.

The package includes the chat library and all its Lua dependencies. Sending requires a chat-enabled Sharp client. Reply rules observe new visible player messages; guild, party and other access restrictions remain enforced by the game. Extended native channel delivery and private replies still await fresh-client verification.

AI writing in Auto Chat

Auto Chat 2.2.0 adds the AI tab. Choose the OpenAI preset or enter a full Chat Completions URL and model ID for a compatible provider. The preset uses https://api.openai.com/v1/chat/completions and gpt-4.1-mini. Authentication uses bearer credentials; the request supplies messages, model, stream: false and an output token limit. See the official Chat Completions reference.

Open Edit API key to enter your own provider key; it is visible while entering. Close the editor afterwards. Keys stay in memory for this module session and must be entered again after a reload. Save setup persists the endpoint, model, style and limits. It never saves the key. API usage may cost money; the default limit is 20 requests per session, at least 15 seconds apart.

Use Draft writer to describe a message and select Generate a draft. Edit the result, then Add as a message draft. Choose a channel and send it yourself or enable its timer. Draft generation does not send to game chat.

For automatic replies, select Generate this reply with AI on a keyword rule and enter reply instructions. For fresh scheduled text, select Let AI write each scheduled message on a message and enter writing instructions. Enable Allow AI for enabled replies and timed messages in the AI tab before starting. Matching player text and your instructions are sent to the chosen provider; the module does not upload full chat history, player IDs or keys in prompts. Existing fixed replies work without AI.

Request limits and compatibility controls the budget, spacing, token count, and max_completion_tokens versus legacy max_tokens. Provider availability, account access and model support vary. Authenticated providers require a loaded client with http.post_json. Older clients can use a keyless loopback HTTP provider through http.post.

Replies retain the chosen channel, exact Whisper identity and existing cooldowns. Generated text must fit 240 UTF-16 units and 256 UTF-8 bytes. Invalid JSON, incomplete responses, commands, tool requests and oversized output are discarded. Pause, reload and map changes discard automatic results. Requests are not retried after errors or timeouts. Offline and local transport tests do not establish a real provider response or in-game AI delivery.

Character Dashboard

Load it after entering the world. Select Show compact HUD for a short name and level label, or Refresh now to request another sample. Missing character values remain Unavailable. The HP percentage reflects the displayed health bar rather than an absolute health value.

Waypoint Notebook

Enter a name, then select Save current position. Choose a saved point to display its label; the marker appears only while your map ID matches its saved map. Use Previous and Next for longer lists. Clearing the notebook requires Clear notebook, followed by Confirm clear notebook.

The notebook stores personal notes in the module's saved state. A failed save keeps the existing notes. It does not move your character. Different instances can share a map ID; a saved marker is a coordinate note rather than a guarantee that the same object exists there.

Game SDK Inspector

Choose Actor members or Character members. Each sample obtains the current character again; named reads use the generated class library. Removed or unavailable values show an error. The displayed method is a declaration, and Callable: false means the script does not invoke it.

Use the game SDK browser to find other members and the generated SDK guide to adapt the example. These modules passed offline behavior and Store syntax checks; their game results have not yet been verified.

Keep repeatable work in a worker, keep rendering in on_tick, and handle unavailable values using the return and error pattern. When your script is ready to share, follow the Script Store guide.

On this page