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

I need help for my lua program in computercraft

I have been recently working on a project to make an airport computer that keeps planes from landing on each other. For some reason, every time I run my program, it gives me an error message. I have another program that also gets error messages,…
0
votes
1 answer

Lua Set Functions in ComputerCraft

I have a ComputerCraft program set to turn on a siren when any non-whitelisted players are near: sensor = peripheral.wrap("top") function arraysubset(a, b) local s = set(b) for _, el in pairs(a) if not s[el] then return false …
Dessa Simpson
  • 1,232
  • 1
  • 15
  • 30
0
votes
1 answer

Recursive loop stopping after a short time

Lua in ComputerCraft 1.5 This seems to work but the recursive loops is breaking after 4 or 5 times running. Cannot seem to see why. Am i doing something incredibly wrong here? Full Code Snippet for the loop: x = 1 function loop() if x > 0…
Derple
  • 865
  • 11
  • 28
0
votes
1 answer

Computercraft Evaluate and Execute relative to ticks

For the sake of writing fast turtle programs, I am wondering how, in relation to ticks, is code executed? Is there a tick penalty for executing functions or evaluating other Lua statements in addition to the time it takes the turtle to move? In…
bcdan
  • 1,438
  • 1
  • 12
  • 25
0
votes
1 answer

Lua - Computercraft - attempt to call nil, but works sometimes..?

Everytime this program startup , the program runs after a server restart this error shows up: startup:13: attempt to call nil When i comment out that line of code the same happens to the line after that, and after that. Until all those four lines…
0
votes
1 answer

Problems diagnosing a "'name' expected" error

I have some code that takes input from the user, then mines the area defined by the input. I'm getting the following error on the second line in the snippet below: bios:367: [string "ChunkMiner"]:2: 'name' expected I can't seem to figure out what's…
Andria
  • 4,712
  • 2
  • 22
  • 38
0
votes
2 answers

ComputerCraft Twitch Follower Program Not Working

I have a program on Computercraft named Twitch that shows how many veiwers and followers I have on Twitch. When I try to run it it gives me this error: twitch:39: attempt to index ? (a nul value) The code is: -- Written By Bacon_Donut --…
Caleb6801
  • 9
  • 1
0
votes
2 answers

Minecraft ComputerCraft Turtles require statement not working

I have been writing a lot of turtle programs lately and find that I am constantly rewriting the same functions. I would like to put all these functions into their own file and then include them at the top of my other turtle programs. Looking through…
metamilo
  • 213
  • 2
  • 5
0
votes
1 answer

Computer Craft modem.open( ) command giving me "attempt to index ? (a nil value)"

I am new to Computer Craft, and I want to get started using Wireless Modems. local modem = peripheral.wrap("top") local channel = 1 modem.open(channel) I have the code above, and when I try to run the modem.open() command, it gives me a message…
Alex
  • 13
  • 1
  • 7
0
votes
2 answers

ComputerCraft Run Chat Command

I host a server and I was wondering: is there any way to run chat commands through ComputerCraft? I want to be able to run /tps through the ComputerCraft terminal and then have it print out the TPS. Help would be greatly appreciated. Thanks.
Lucas Baizer
  • 305
  • 2
  • 5
  • 13
0
votes
2 answers

Lua Minecraft ComputerCraft function issue

Okay so here is my function: function button1() mon.clear() sleep(.25) shell.run("movie") end Says: "attempt to index ? (a nil value)" for the shell.run("movie") line
cj89898
  • 67
  • 5
0
votes
2 answers

How do I make os.pullEvent not yield?

I'm trying to create a while true do loop, that reacts to clicks, using os.pullEvent, and also updates a monitor. Problem being, it only updates the screen when I press one of the on screen buttons, and I've found out that's because pullEvent stops…
TMH
  • 6,096
  • 7
  • 51
  • 88
0
votes
0 answers

How do I get the color of a point inside a triangle?

What I'm doing is building a rough GL-like API for a Minecraft mod called ComputerCraft... I've gotten pretty much everything needed and was able to draw a white triangle on a black BG. What I'm trying to do now is find the color for the "pixel"…
Tcll
  • 7,140
  • 1
  • 20
  • 23
0
votes
1 answer

Show image in Lua

Is there a way to show an image in Lua? I tried things like load_image (I saw something like that in the ComputerCraft documentation) but can't get it to work. The purpose of this is to show an image in Computercraft, which uses LUA to write…
William
  • 427
  • 1
  • 9
  • 22
0
votes
1 answer

Lua double results showing

So my lua script is showing double results: It should only show one of each type of fluid. This is the part of the script : function firstToUpper(str) return (str:gsub("^%l", string.upper)) end function dispTanks() mon.setCursorPos(offsetPos,…
Kev30
  • 119
  • 1
  • 9