Replies: 1 comment 2 replies
-
You can put pocket computer in offhand and r-click it. It opens it in keyboard-like gui mode. All your inputs then go to pocket. You can then write your own program that would transfer events from pocket to target computer you wish to communicate with.
This kind of special character handling is build in into high level functions of
No there is no way to change network name of peripheral. Some players have wrote their own
Websocket and http are only ways to do it if you don't have direct filesystem access to folder where minecraft world is saved. There is no way to directly "download" files.
Drag and drop is event. So you could easly write your own import program that would auto save and run the program. So your loop would become "run debug program, drag and drop file" and then have program auto save dropped file and run it/do whatever you need to test it. EDIT: Additionally for last 2 questions. If you are developing for remote system, you might find https://remote.craftos-pc.cc/ to be of use for you? It uses websockets and allows you to locally access files that are on remote CC computer (on server) and edit/work on them. It might simplify your workflow? |
Beta Was this translation helpful? Give feedback.
-
I'm currently playing a modpack with a group of friends that includes CC:Tweaked, for 1.20.1 NeoForge, and have a few questions with using the mod mainly concerning transferring files (both to and from the CC computer), interfacing with peripherals, and any tips or features I might not be aware of that might help.
My current goal is to manage a line of machines, being able to extend the "bank" of machines easily.
Machine A produces 6 redstone with a 50% chance of 1 extra, and I want to divide this output into stacks of 4 (into machine B) and 2 (machine C), with the extra handled separately; I'd eventually like to tile this so I can simply add more machines side-by-side without adding more computers.
In my work to do this, I've broken the problem down and started with a function
moveItems(source, dest, item, count)
which takes 2 wrapped peripherals, an item name and a count as argument, does the requested move, and returns the number of items actually moved, handling multiple stacks if they exist.In this, I also was able to use the REPL to query how the slots in the machines I'm using are enumerated by filling all slots with unique items and printing the formatted results of
inventory.list
to a monitor.My testing has so far mainly been with the machines (peripherals) directly attached to the computer.
In moving to using network cables to make this tileable, I'm running into difficulty reading long output from the REPL; the built-in advanced computer screen is quite small, and it can be difficult to read the entire output.
It also seems like the peripheral number for each attached inventory is incremented as the devices are moved around; makes sense as a hardcoding prevention. I'll use tables/arrays plus
peripheral.find
to enumerate and loop over all attached devices.I installed MBS, or Mildly Better Shell, which has helped a ton especially with readline bindings (in the REPL too!), the scrollback support with the mousewheel, and improved autocomplete.
If I need to read large outputs, I usually run the REPL with the
monitor
command and a large advanced monitor above the computer, but it's often fiddly to both type on the computer and see the monitor behind the CC "inventory" terminal.I've been using the file transfer system to paste in local files as I develop and test, which is much faster than writing them manually in the CC terminal. Much faster development and less re-typing. It's great to load up the REPL and run
require("test")
and have a known state.With that background, my questions are these:
\r
and\n
seem to work in a terminal, they aren't processed when calling thewrite
method of a wrapped monitor. Is there a better way to do newlines than reading the current cursor's row, incrementing it if not at the bottom of the screen, then writing it back? My quick-and-dirty method for outputting debug and querying was to write a small function to set the cursor pos to(1, COL_MAX)
and then call thescroll
method of the monitor.peripheral.getName
only seems to give the network name of a device, likeleft
orright
for devices directly adjacent.lua
, manually typerequire("test")
in the REPL", which is a little cumbersome at the manual-typing step.I'll likely come up with more questions, but if I understand the Q&A section right, I can add to this later?
Beta Was this translation helpful? Give feedback.
All reactions