Since its inception, the program has had the ability to write custom code in C#. In the early versions (around spring 2021), it was very painful and inconvenient, but still possible. The second version was released in spring 2023 and introduced features such as the ability to use an external IDE for writing programs and significantly enhanced scripting capabilities, for example, creating a full-fledged custom user interface using Blazor. Essentially, this unlocked the potential to write powerful scripts, although there were still many obstacles and "peculiarities."
And now, in spring 2024, a new version of scripts is gradually emerging. In this third generation, the scripting system's capabilities are enormous - almost everything the program itself can do is accessible, with the ability to connect external NuGet packages, protection against crashes and common errors, and much more. The entry barrier has also been significantly lowered - new APIs have been added, diagnostics improved, and so on.
The program is built on the .NET platform. It is a rapidly evolving platform that is highly flexible and efficient. The scripting language used is C# 12.
Every script you write will be compiled using Roslyn. Most of the headaches related to how to include files, what can be done, and what cannot, have already been solved within the program itself. This leaves you to focus solely on working with the script.
There are three ways in the program to run your code, all of which will be executed within a sandbox.
The simplest option. You just need to add a "C# Script" action. It follows the same rules as any other action, so to run it, you need to add a trigger. For example, you can add Hotkey Is Active, assign it to a button, and activate the script on press/hold.
A more complex option - your script will be executed at specific time intervals. It is expected that somewhere in the code, you will return true/false or null, which will activate or deactivate the trigger. Then you can attach actions to the trigger, including script actions. The increased complexity lies in the fact that your script runs continuously and is controlled only by Enabling Conditions. Therefore, you need to write code more carefully; otherwise, you may find yourself in a situation where a script error constantly takes control of the mouse/keyboard or consumes all available memory on the computer.
The most advanced scripting option. In addition to everything available in actions/triggers, WebUI allows you to create a custom user interface with buttons, switches, and input fields. The UI technology used for rendering is called Blazor, and as of 2024, it is the best infrastructure that .NET can offer. While the technology itself has some issues since perfection doesn't exist, EyeAuras provides solutions that smooth out these problems, ultimately limiting your possibilities only by your imagination. Below are some examples of different forms assembled on WebUI.
February 20, 2024
At the time of writing this article, WebUI still uses an older version of scripts, which will be updated in the coming weeks.
Both the program and API are built on something called Dependency Injection. In simple terms, the program is divided into small pieces, each responsible for its own task. Just like in a big house where someone cooks porridge, someone sews socks, and someone doesn't know how to do anything but still exists.
Each entity in this house has a name. For example, if you want to move the mouse, you need to refer to ISendInputUnstableScriptingApi and call MouseMoveTo. If you want to play a sound, you would go to IPlaySoundScriptingApi. Responsibilities vary, and just like in life, knowing the correct names is crucial for success. This documentation will list the main and most useful services, but there is no point in listing the full spectrum - the NuGet package EyeAuras.SDK lists everything that can be used and available to your scripts.
If every programmer started from scratch, we would still collectively reinvent the wheel. Therefore, scripts fully support external packages. In the .NET infrastructure, almost everything is stored in NuGet, including official and unofficial libraries. There are dozens of lists of useful packages; you can start with this one. You can connect almost any of them in scripts. There are currently some exceptions, but I am working on resolving them.
February 20, 2024
Currently, external library support is only enabled for alpha testers. Once this functionality stabilizes, it will be available to everyone else. I expect these restrictions to be lifted in early to mid-March.