-
Notifications
You must be signed in to change notification settings - Fork 7
Creating external program
This page explains how to create and execute independent, external Expression2 programs within ALX OS using a Remote Executor expansion board.
Unlike Embedded Programs, external programs do not require modifying the core CPU/GPU chips or rebuilding the OS. They run in an isolated environment directly on the hardware module.
This functionality relies entirely on the Wiremod E2 remoteupload extension. Before proceeding, ensure that this extension is enabled on the server via the console command:
wire_expression2_extension_enable remoteupload
If this extension is disabled, the Remote Executor board will not function.
- Spawn a Remote Executor board (located inside advdupe2 under
alx_pc/parts). - Install the component into an available PCI slot on the ALX PC motherboard.
ALX OS supports three ways to execute external code through the Remote Executor. The choice depends on whether the code is raw script with not includes, a direct local path, or bundled inside a compressed package with custom assets and includes support.
-
How it works: ALX OS reads the file containing a full Expression2 source code and executes it via the Remote Executor using remoteupload. No includes supported.
-
Deployment Steps:
- Copy your E2 script from
garrysmod/data/expression2/(e.g.alx_pc/gpu/remote/testprog.txt) into your local foldergarrysmod/data/e2files/. - Inside ALX OS, create a file named
testprog.e2r. - Set its content to point to your local file:
file://testprog.txt. - Run the
.e2rfile.
Note: Any
#includewill cause an error! This must be totally self-contained, isolated code.
-
How it works: The file contains a direct string path pointing to an E2 file already located inside the
garrysmod/data/expression2/directory. The Remote Executor runs it directly from your machine. -
Deployment Steps:
- Inside ALX OS, create a file named
testprog.e2p. - Set its content as
alx_pc/remote/testprog_e2p.txt(relative togarrysmod/data/expression2/). This is just a string value with path NOT actual code! - Run the
.e2pfile.
Critical Note: For
.e2pexecution, you must add#include "alx_pc/remote/e2p_include"in your code. Without this, the Remote Executor board will break! Also, any include must exist locally on the machine.
-
How it works: This format allows you to package your main E2 script, include-dependencies, and static assets (custom files) into a single compressed
.ziparchive. This is ideal for complex isolated programs that require external data or includes.
-
How it works: This format allows you to package your main E2 script, include-dependencies, and static assets (like custom text files) into a single compressed
.ziparchive. This is ideal for complex isolated programs that require external data. -
Deployment Steps:
- Create a work folder on your real PC:
garrysmod/data/e2files/testprog_e2z/. - Inside it, create an internal folder named
e2files. - Save your main execution script (e.g. testprog_e2z.txt) inside
testprog_e2z/e2files/strictly under the name_main_.txt(resulting intestprog_e2z/e2files/_main_.txt). - Copy the file includes/example_e2z.txt into the folder
testprog_e2z/e2files/alx_pc/remote/includes(you will need to createalx_pc,alx_pc/remoteandalx_pc/remote/includessubfolders). - Create any static asset files (optional), such as
testfile.txtwith your custom content, directly in the root of your work folder (testprog_e2z/). - Compress all files and folders from inside
testprog_e2z/into a single ZIP archive.-
Crucial: The root of the zip archive must immediately contain your asset files (like
testfile.txt) and thee2filesfolder. If you see the parent foldertestprog_e2zinside the root of your ZIP archive, you did it wrong!
-
Crucial: The root of the zip archive must immediately contain your asset files (like
- Rename your compressed archive (e.g.
testprog_e2z.zip) totestprog.zip.txtand place it intogarrysmod/data/e2files/. - Inside ALX OS, create a file named
testprog.e2zand set its content to point to your archive:file://testprog.zip.txt. - Ensure a Remote Executor board is installed in a PCI slot, then run the
.e2zfile.
Critical Note: Just like
.e2p, you must add#include "alx_pc/remote/e2p_include"in your_main_.txtcode. Assets are passed safely via theremoteevent payload. In.e2zyou don't have to adde2p_include.txtinto the archive, as it is loaded automatically by the Remote Executor.
Reference Template: There is an example e2z file on GitHub: example_e2z.zip.
You can check its structure and copy it togarrysmod/data/e2files/.
Then rename it toexample_e2z.zip.txtand use asfile://example_e2z.zip.txtwhen creating a file in ALX OS, or load it via HTTP using:https://raw.githubusercontent.com/AlexALX/wiremod_e2_os/refs/heads/master/examples/example_e2z.zip.
You can check the example code and archive structures inside the repository:
- testprog.txt (Raw .e2r Template)
- testprog_e2p.txt (.e2p Source Script)
- testprog_e2z.txt (.e2z Main Script)
- example_e2z.zip (.e2z Archive Template)
[ALX OS File] -> [Reads Function Name] -> [Triggers Core CPU] -> [Triggers Core GPU]
[ALX OS File] -> [Reads Source/Path/Archive] -> [PCI Card (Remote Executor)] -> [remoteupload to separate chip]