Extending the CS's scripting language
Posted: 11 Jul 2023, 13:29
Hello,
Because I'm locked to 0.47 (long story), I have to do all my scripting in the CS's scripting language rather than Lua, at least for the time being. I find it a bit clunky, so I stayed up all night hacking together a way to extend it a bit; in essence, I added syntactic sugar, write files with the new syntax, and process these to create new files that I then paste into the CS.
What I used this hastily put together method for is defining functions to save me from manually inlining, unrolling loops and writing multi-line expressions, but I think further improvements should be possible. So, two things:
1) I could use a standalone version of the syntax check from the CS, that way my program can give error messages. Point me to the files if there isn't such a thing yet, I'll compile it myself.
2) Could there be a way to write the output script directly into an *.omwaddon/*.esp? Or alternatively, generate an *.esp containing the updated scripts? That would save me opening the CS and manually pasting in the expanded code. I mean, doing it manually is doable for one or two scripts, but anything large-scale would be nightmarish -- I'd much rather automate the process so I can simply write and compile from the terminal, which is what I'm used to. Again, point me to the files ;>
I'm glancing through the engine sources to try and figure out where I want to start reading, most likely the compiler/interpreter duo. We'll see.
Cheers.
Because I'm locked to 0.47 (long story), I have to do all my scripting in the CS's scripting language rather than Lua, at least for the time being. I find it a bit clunky, so I stayed up all night hacking together a way to extend it a bit; in essence, I added syntactic sugar, write files with the new syntax, and process these to create new files that I then paste into the CS.
What I used this hastily put together method for is defining functions to save me from manually inlining, unrolling loops and writing multi-line expressions, but I think further improvements should be possible. So, two things:
1) I could use a standalone version of the syntax check from the CS, that way my program can give error messages. Point me to the files if there isn't such a thing yet, I'll compile it myself.
2) Could there be a way to write the output script directly into an *.omwaddon/*.esp? Or alternatively, generate an *.esp containing the updated scripts? That would save me opening the CS and manually pasting in the expanded code. I mean, doing it manually is doable for one or two scripts, but anything large-scale would be nightmarish -- I'd much rather automate the process so I can simply write and compile from the terminal, which is what I'm used to. Again, point me to the files ;>
I'm glancing through the engine sources to try and figure out where I want to start reading, most likely the compiler/interpreter duo. We'll see.
Cheers.