TorqueScript Bot

As a programming language nerd with an obsession for the Torque Game Engine (maybe a subject for future posts?) and more specifically the crude kind of scripting languages, I found it frustrating that the only way to test out a bit of TorqueScript code was to launch a compatible game and then to evaluate the code into that game...
So with the help of a neat website by "Lukas J" I hooked up a Discord bot to it that can receive commands and relays the code to that website and returns the evaluation result.
Natually from the nature of that website, it is limited to the Torque3D flavor of TS (using the TS Neo VM) for now, but later it could be expanded to support the TGE flavor deployed in an actual docker container on my server instead of relying on a third party website, that's something to think about (and a proper opportunity to figure out docker haha).

The bot supports both commands and messages (for servers where slash commands are unauthorized) along with minimal support for Markdown code blocks, all of the following messages shall work:
/eval ts-code-here
$eval ts-code-here
$eval `ts-code-here`
$eval ```ts-code-here```

It's not really a complex project by any means and mostly relies on discord.js, some async calls and fetch. But it was a neat way for me to familiarize myself once again with the process of making a Discord "Application".

Here's the invite link for the bot.
I hope this was of any use to even a single person on this planet lol.
viwrap - 2024-06-06 08:24:18

Nothing?

Nope... there is still nothing to show (i JUST merged the v1 of this blog system).

I don't have much to show yet (exams are taking all of my time) but various projects are very slowly underway... They range from programming languages to whole networked videogames and many things inbetween. It wouldn't be a surprise if only a few of them make it past even the alpha stage (or at all 😔)
The sidebar isn't very well furnished either... but the search feature works! I even have my own dashboard to write this stuff sort of neatly!

So to fill some of the void here's a small demo of a language I was working on in 2023 in C:

looks somewhat basic, but behind the scenes this is a completely custom parser, AST generator and bytecode writer, all of which can work on their own without relying heavily on previous structures. The bytecode also contains metadata such as the language version and a string table for strings as well as identifiers. This screenshot in particular shows calling of methods on objects using the lua rule of prepending the "this" object at the start.


The language also natively supports object types and type testing, this was already very satisfying to get working.


It is also completely stack-driven, each expressions are reduced to a stack entry and the 2 top entries are the hottest values in the execution cycle, that is, they get checked and changed often (then pushed and popped if they really need to be). This screenshot doesn't show it well but functions can also discard stack entries that are computed but end up not getting used in the call (otherwise they would stay here forever unused, gradually clogging up the stack and potentially leading up to an overflow).


This isn't in any particular order, and again please ignore the silly (albeit objectively hilarious) naming of things. This screenshot is meant to show among other things that functions are first class just like objects and can behave likewise (internally they are actually objects).

That's it! That's all I have to show, I just wanted an excuse to have this blog not be empty on arrival to show you my crude little toy language :)
Let's hope I get motivated enough to finish this and other things one day.

And since this blog still doesn't have a socials section (again, v1) here are some links:
github
X (twitter)
viwrap - 2024-03-18 21:40:11
copyright © 2024, viwrap. custom blog software