Questions tagged [computercraft]

ComputerCraft is a Minecraft mod which adds Lua-based scripting.

ComputerCraft (often also called CC) is a modification for the game . It adds new blocks (known as Turtles and Computers) and Items (known as Pocket Computers) to the game. They can be programmed using -based scripting.

141 questions
0
votes
1 answer

How can I rotate 2D radar positions in Lua based on display rotation?

I am attempting to create a radar system, it already displays positions of detected objects on a display but I need to be able to rotate those positions around the center by the rotation of the display. I have researched this problem but any details…
0
votes
1 answer

Is there a way to properly encode json in CC Tweaked with lua?

I am running a websocket server for the ComputerCraft: Tweaked mod. I have the server reciveing what appears to be a JSON object from the turtle inside of minecraft but the server is unable to proccess it as JSON and thinks it is just a string. Here…
0
votes
1 answer

Lua: Key pressing

Is there any way to detect key pressing in Lua? Im using replit for excecuting my own code. (Im new to lua) In roblox (eLua), computerCraft mod, there some kind of key function that lets you detect, if key up or down, what kind of key pressed. i…
0
votes
1 answer

ComputerCraft (Lua) Can "attempt to index a nil value"error be trapped to prevent the script from haulting

I've written a Lua script for ComputerCraft to control a mob farm. What I'm doing is checking the amount in specific Functional Storage drawers. The API for the mod has, at least to me, a weird quark that if the storage drawer is empty then the…
0
votes
1 answer

Problem with getItems() in CC: Tweaked with Advanced Peripherals

I'm using the Inventory Manager from Advanced Peripherals, and I'm trying to make a script that transfers my inventory to a chest but keeps the positioning of all the items. The getItems() function is supposed to return a table in which the keys are…
0
votes
0 answers

ComputerCraft coroutine can't move turtles (1.19.2; Fabric)

I've tried to make a control panel for my mining turtle, so I got into using Lua coroutines, because I needed the turtle to listen even if it's currently mining, but every time I call function round() it won't continue. I tried to place…
0
votes
1 answer

I'm having some problems with html select element, html buttons and html websocket connections

`