r/Tf2Scripts • u/ArgosOfIthica • Sep 04 '20
Resource scalu: A programming language for configuration files
Hey everyone!
A while ago, I made a post about implementing arithmetic into the scripting system. I've been iterating on it since then, and its come quite a ways.
scalu is a stand-alone event based programming language written in Python, with support for 8-bit arithmetic, if-else control flow, recursion, printing variables to console, sandboxing, and automatic generation and management of binds and special files (classes, autoexec, listenserver, etc), that all compiles down to a single cfg file. The language is semantically as expressive as config files alone, which means that almost all programs that can be expressed with regular configuration files can also be expressed in scalu, but usually much more easily.
The source code as well as examples can be found on the Github: https://github.com/ArgosOfIthica/scalu. Examples currently include a "perfect" weapon state script (tracks all classes), as well as the classic null movement script. There's also a small wiki: https://github.com/ArgosOfIthica/scalu/wiki
I've also created a repl for those who want to try it out in their browser, though obviously having the compiler locally is a far superior experience. Edit the program string, then hit "run" to compile a text based config.
Its also worth noting this will work for most source games. Nothing about this compiler is actually specific to TF2. A lot of testing was done in Half-Life: Source, for instance. The only assumption it makes is that the config system has bind , alias and other basic Quake-like syntax.
View all comments
Show parent comment
2
u/ArgosOfIthica Sep 04 '20 edited Sep 04 '20
Sure. Here's null movement, weapon state, and the splash logo globbed together https://pastebin.com/YcuXjG5W.
And yes, stuff like the native Null Movement script is already very dense, I don't think I will ever be able to beat it on that front. Readability was always the goal. An approach I've considered might be basic template/metaprogramming facilities, which would be performant and make things denser, but tend to not be very readable.
In any case, the language is being built to be scalable. The main appeal for an experienced scripter like yourself isn't that an isolated script is more or less dense, its the ease with which you can add onto and organize your existing scripts. Weapon state, class state, etc. are just numbers now.
EDIT:
Also worth noting that the language isn't necessarily complete. Accessing variables in other namespaces, type manipulation, iteration, etc. are planned for an upcoming update. Mostly looking for feedback in terms of wanted features and points of confusion in the syntax.