It's not a cheat if the AI car is just as fast as you can be😁.
I had to dive into the syntax myself, there's not much available, or it's a bit hard to find. I'm not a coder, so i just pick up apps i enjoy or find to have nice coding stuffs, and i transfer the idea to what i want to be done.
Most of the new CSP APIs, you can find them in the lib file in assetto\extension\internal\lua-sdk\ac_apps
Otherwise i got most from here :
https://github.com/CheesyManiac/cheesy-lua/wiki/Getting-Started-with-CSP-Lua-Scripting
As for the AI Hints and how they are implemented thru an lua app, watch my code on this app, i went for a very simple solution :
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
www.mediafire.com
Basically, a reader gets the file, caches it. The position counter then goes thru the positions values, enables a state or not for HINT, BRAKEHINT, etc... there's a viewer for zones for you to check if it's triggering the states or not.
In the code, the PreventMistake is correlated to [BRAKEHINT_*]
Dangerzones tweaks correlated to [DANGER_*]
Once you get a grip on that (or just copy bits of my code and edit parts to your preference, that would work as well), it's pretty easy to implement zones.
To go further, get my AIHints Reader. You should be able to add comments on HINTS. At the moment i strictly dismatch any comments to be taken into account for both apps, but that doesn't mean you couldn't change the condition and allow comments to actually declare zones.
Example, in the ai_hints.ini :
[DANGER_0] ; Safe
START=0.114000
END=0.123000
LEFT=0.93
RIGHT=0.50
[DANGER_1] ; Safe
START=0.125800
END=0.149000
LEFT=0.50
RIGHT=0.00
[HINT_1] ; Safe
START=0.132001
END=0.170990
VALUE=0.970
[HINT_2] ; Unsafe
START=0.171000
END=0.182000
VALUE=0.995
A little condition setup later, with comments implemented, the reader would declare Safe and Unsafe zones, independantly from HINTS, with different triggers for either aicaution, splineoffset, etc...
Quite elegant in my opinion, perf cost : almost nothing, as it would be triggered once per car on each zone (rather than checking on each frame which would be immensely costly).
You can mix them with HINTS zones as well, add a timer to reset default settings after a situation is called. From there the only limit is your imagination lol.
You can then declare and apply tweaks for each type of zone.
There's no impact if the app is not called, no extra file, the comments are just here to trigger situations in the app.
I went with the HINT zones first as it was easier to implement, but there's a whole world to explore.