Damian Small

HRL - Development Blog 3

It has been some time since I last touched this project, however after looking into some alternatives to hac2, I found Chimera which is a actively maintained mod, which has quite a lot of features. The one we are interested in LUA scripting.

The issues that caused me to drop hac2 were that in some instances, the lap complete event would just not trigger, no way to tell if the player is the driver of the vehicle, and I'm not sure if it was just my inexperience, however I found if I did too much in the onTick event, it would freeze up the game, as if the code was running on the main thread, and not in the background.

All of these issues are resolved in Chimera, though it does not contain all of the events that hac2 contained, for example Chimera does not have an event for Score, Player Death, etc.

Though saying this, with Chimera, some memory addresses, and some coding, we can handle all of these in the onTick event.

After about 2 days of coding, I have a fully working LUA script, minus one very important feature. I don't have a to report the lap times to the server, as Chimera is using clua, which doesn't have a ffi implementation like SAPP does. What this means, it that we are unable to import custom libraries to handle sending the lap times to the server, nor does Chimera bind cURL to LUA, so even if Chimera does have cURL as a dependency, we are unable to access it.

I did have a rather hacky solution where I would use LUA to spawn a cmd.exe instance, and then using PowerShell, we can use the Invoke-WebRequest command to send the data to the server. Unfortunately this didn't work, as it opened a cmd.exe window which stayed open for the duration of the request. This took focus away from the game, and prevented you from playing until the request was complete.

Basically, until I can find a way to get a HTTP request library working in LUA on a embedded instance, or if Chimera passes through the cURL functions (maybe implementing something like Lua-cURLv3) I am at another standstill.

For now, I have uploaded the code so far to my EffakT/HRL-Chimera-LUA-Script on my Github. If you happen to know how to get HTTP requests working, without the need to install any software on the player's machine, feel free to make a pull request or let me know and I'd be happy to look at implementing the solution.