Getting Started with AsterUI Pages
This guide assumes you are making a UI page, not an ASI/RPH plugin.
Target platform: Grand Theft Auto V Legacy Edition, Windows PC, Story Mode. The Enhanced Edition, FiveM, RedM, and GTA Online are not supported.
Tools
- A text editor or IDE.
- A normal browser for preview.
- Optional: Node.js for the Vite example.
You do not need Visual Studio or the ScriptHookV SDK to author a UI page.
Create a page
Copy an example:
text
examples/hello-overlayPlace your copy under:
text
AsterUI/ui/my-ui/The entry file must be index.html.
First script
js
window.addEventListener("asterui:ready", () => {
window.asterui.on("myui:state", (state) => {
document.getElementById("value").textContent = state.value;
});
window.asterui.emit("myui:request", {});
});The plugin receives myui:request and may respond with:
js
// Conceptual plugin-side event sent to the page.
window.asterui.on("myui:state", (state) => {});In the page, the event arrives through the registered callback above.
Browser preview
Include the mock before your app script:
html
<script src="../../sdk/js/mock.js"></script>
<script src="app.js"></script>The mock implements on, off, and emit and dispatches asterui:ready.