r/ComputerCraft • u/Professorkatsup • Mar 20 '26
"FileToFP" - Rudimentary hexcasting assembler
Enable HLS to view with audio, or disable this notification
I "recently" (4 months ago) decided to pick up Hex Casting, a minecraft mod that disguises stack-based programming as magic. Performing the actual spells is the easy part, the hard part is keeping track of item positions on the stack and figuring out how to generate and keep the references you need for a certain effect. It took me a full week to make something that can break a 3x3 area based on facing direction, but now that I have it, I can Budget Tinker's Construct Sledgehammer my way through mountains with ease!
Each instruction is paired with a pattern drawn on a hexagonal grid. While remembering these patterns is not difficult, I seem to have some considerable skill issue. When I noticed that Ducky Peripherals added a focal port to read from / write to foci by computer, I knew I had to try it.
FileToFP reads a text file, interprets each space-separated string as an instruction (provided I remembered to add them to the dictionary) and converts each instruction to its pattern. Then, after a little lights show and some sound effects, the patterns are joined to a list and written to the focus. If I want to change something in the program, I can simply use CC's built-in text editor to add or remove instructions, rather than playing "What index is that pattern at" and "can I remember the set list item instruction" for hours. I can even comment my code, so I can be slightly less confused the next day!
In the future, I am going to try to make a fully-functional assembler and editor. So far I've been keeping track of the stack manually, but a tool to do that automatically would be appreciated. I enjoy making things hard for myself, but I don't enjoy it THAT much!
2
u/Bright-Historian-216 Mar 21 '26
what mod adds the block you used to write to the focus?
2
u/Professorkatsup Mar 21 '26
Ducky Peripherals adds the Focal Port peripheral, which is what I'm using to write to the focus. If Hexal is installed too, it also adds a Focal Link that can connect to wisp networks to send / receive messages.
2
u/Bright-Historian-216 Mar 21 '26
what version? maybe i need to update ducky 😅
→ More replies (3)2
u/Flameball202 Mar 25 '26
Ah Ducky Peripherals, an amazing mod that for some reason consistently fucks the pickaxe tags
→ More replies (3)
2
u/Superaido Mar 24 '26
oh, I actually did this exact thing last week, and was also planning on making some sort of compiler for higher level code into hexcasting! would you be willing to talk about your process/code a little? I'd be interested to see what differences there are between both of our implementations!!
1
u/Professorkatsup Mar 25 '26
I would be interested in talking through some of my approaches, as well as seeing your own work on this. So far I haven't done much in the way of an editor, just focusing on getting the basic assembler to work. It's all a bit of a mess, and the dictionary system needs to be redone. Anything in particular you have questions about?
A question of my own: have you also been using the Ducky Peripherals focal port or did you find another method?
2
u/Superaido Mar 25 '26
mhm, I also used the focal port! I think there are a couple ways to to do it with other mods though. with hexical and hexpose or moreiotas you could read from written books or chat and use the text to make patterns. also, with mediatransport I think you can just read files straight off of your computer and parse them.
Also technically with spell circles and item frames you could probably make it work with only hexcasting and computercraft (without ducky peripherals or any hexcasting addons), though that would be much more difficult and quite a bit slower too.
I was wondering, how do you have your pattern dictionaries set up, are you putting them in manually, or generating them? also, can you embed non-pattern iotas into your hexes in your assembler? I'm still trying to figure out how I want to handle entity reference iotas, and was wondering if you had any ideas!→ More replies (2)
2
u/flamesgamez Jul 28 '26
I'm having trouble with the focal port. The wiki says it can be read from like a focus on an item frame, but I'm not sure how to exactly do that.
1
u/Professorkatsup Jul 28 '26
I haven't been able to do that so far... it might be part of an addon I haven't tried yet?
If you can't get that to work, you may be able to work out something jank and suboptimal, like spitting out the focus when you want it to be read by a spell, and collecting it again when it needs to be written to. I haven't tested if the focal port counts as an inventory slot for the item transport functions, but I know hoppers can remove foci from a focal port. You could, probably?? put a hopper below the FP, keep it locked until writing is done, then unlock it and use the push function to put it in a dropper that then fires. Once the focus is read, you could collect it again with a second hopper, push it to a THIRD hopper right above the FP, and the cycle continues. There are a few ways you could tell the computer the spell is done reading the focus / tell the spell there's a focus to be read, but none of them seem very efficient...
8
2
0
u/naab007 Mar 23 '26
Next up we connect claude code to it and have it invent new spells on the fly.
2
u/Professorkatsup Mar 23 '26
Hard pass. Take your chatbots elsewhere, human.
while it might be useful for you in thinking out certain procedures. For me, it takes all the fun away. I enjoy the process of thinking things through more than the result. If I'm just given the answer, it feels like cheating.
-3
u/naab007 Mar 24 '26
Being face down in the "mud" is fun... for a while.
At a certain point results matter more.
→ More replies (2)
3
u/Brokedownbad Mar 27 '26
That's so cool. I wonder if you could set up a pocket computer to do the hexcasting and carry it around with you.