This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
GamersUnited556's profile picture

Tekkit classic Reactor program

Started by GamersUnited556, 19 August 2016 - 08:24 PM
GamersUnited556 #1
Posted 19 August 2016 - 10:24 PM
I've been messing around with a reactor program on Tekkit classic for a while using ComputerCraft and its redpower functions,
But when I started using this program
http://pastebin.com/LZzDF7yZ

I just got an "error" i'm saying "error" because its not formatted like a regular error it will just say

CraftOS 1.3
16
> _

it will have a random number there even though its not set to output anything yet.
I have tried the individual components before making this and some combinations, but this one won't work for some reason.

I have tried adding and removing end's, removing spaces, checking over my spelling over 20 times now, adding sleep statements, and more but nothing has worked yet.
KingofGamesYami #2
Posted 19 August 2016 - 11:19 PM
Looks just fine to me. It shouldn't error like that.

Have you tried restarting the computer?
GamersUnited556 #3
Posted 19 August 2016 - 11:22 PM
Yes, a few times, sometimes it will give an error that will say "expected end of file" and i will fix it but thats it"
GamersUnited556 #4
Posted 20 August 2016 - 12:06 AM
The code is fine, the version just doesn't like me using methods (function)
KingofGamesYami #5
Posted 20 August 2016 - 12:15 AM
Functions should work fine. Although, you should define them as local. And they really should be outside the loop. But it should work as is…


term.clear()
term.setCursorPos(1,1)
i=1
local function reactor()
  A = rs.getInput("back")
  if A == true then
    print("ON")
  else
    print("OFF")
  end
end
local function coolant()
  B = rs.getInput("left")
  if B == true then
    print("OFF")
  else
    print("ON")
  end
end
local function uranium()
  C = rs.getInput("right")
  if C == true then
    print("OFF")
  else
    print("ON")
  end
end
local function uranium2()
  F = rs.getInput("right")
  if F == true then
    rs.setOutput("right",true)
  else
    rs.setOutput("right",false)
  end
end
local function reactor2()
  D = rs.getInput("back")
  if D == true then
    rs.setOutput("back",true)
  else
    rs.setOutput("back",false)
  end
end
local function coolant2()
  E = rs.getInput("left")
  if E == true then
    rs.setOutput("left",true)
  else
    rs.setOutput("left",false)
  end
end
while i == 1 do
  print("-=Reactor Control V.03=-")
  write("  -Reactor Status: ")
  reactor()
  write("  -Coolant Flow: ")
  coolant()
  write("  -Uranium Refill: ")
  uranium()
  print()
  print("What option would you like to change:")
  print("reactor   |   coolant   |   uranium")
  write("Type Option:: ")
  input = read()
  if input =="reactor" then
    reactor2()
    os.restart()
  end
  if input =="coolant"then
    coolant2()
    os.restart()
  end
  if input=="uranium"then
    uranium2()
    os.restart()
  end
end
HDeffo #6
Posted 20 August 2016 - 04:37 AM
The tekkit classic version of computercraft unfortunately is bugged beyond belief. I gave up even trying to run the built in programs of the turtle on that version. Sounds to me that's what you are noticing as well. Cant really do much about it since its an outdated mudpack though.
GamersUnited556 #7
Posted 20 August 2016 - 05:12 AM
I fixed my code for the most part, working on some small kinks now
GamersUnited556 #8
Posted 20 August 2016 - 04:14 PM
Finished code with all the bugs i had worked out
http://pastebin.com/Ss1cuRJA