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

Lua error control:50: 0 and control:57:

Started by quique18c, 12 January 2014 - 01:08 AM
quique18c #1
Posted 12 January 2014 - 02:08 AM
Title: Lua error control:50: 0 and control:57:

Hi, i am new to the forums, but im old with computercraft *-* , about 1 year ago C:
I talk spanish, but i can understand english and type in english C:
I know lua but not too much as pro's D:

I need help, im making a IC2 nuclear control menu, its VEEERY simple.

Here is the code:

function clear()
  term.clear()
  term.setCursorPos(1, 1)
end
local function cprint(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
local function cwrite(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
write(text)
end
local reactor = ("2")
local nucleo = ("4")
local onoffcolor = (colors.red)
local energycolor = (colors.blue)
local onoff = "OFF"
local energy = "OFF"
local p = peripheral.wrap("back")
function menu()
clear()
term.setTextColor(32)
cprint("Reactor " ..reactor)
cprint("#===============================================#")
cprint("#											   #")
cprint("#				   Nucleo  " ..nucleo .."				   #")
cprint("#		 1-  Apagar/Prender el reactor		 #")
cprint("#	   2-  Cortar/Abrir energia saliente	   #")
cprint("#			 Estado del nucleo " ..onoff .."			 #")
cprint("#			 Energia Saliente: "..energy .."			 #")
cprint("#											   #")
cprint("#===============================================#")
end
function menusel()
cwrite("Su eleccion:")
input = read()
if input == "1" and onoff == "OFF" and energy == "OFF" then
  p.setBundledOutput(onoffcolor)
  onoff = " ON"
  sleep(1)
  clear()
  menu()
  menusel()
elseif input == "1" and onoff == " ON" and energy == "OFF" then
  p.setBundledOutput()
  onoff = "OFF"
  sleep(1)
  clear()
  menu()
  menusel()
elseif input == "1" and onoff == "OFF" and energy == " ON" then
  p.setBundledOutput(onoffcolor, energycolor)
  onoff = " ON"
  sleep(1)
  clear()
  menu()
  menusel()
elseif input == "1" and onoff == " ON" and energy == " ON" then
  p.setBundledOutput(energycolor)
  onoff = "OFF"
  sleep(1)
  clear()
  menu()
  menusel()
elseif input == "2" and onoff == "OFF" and energy == "OFF" then
  p.setBundledOutput(energycolor)
  energy = " ON"
  sleep(1)
  clear()
  menu()
  menusel()
elseif input == "2" and onoff == "OFF" and energy == " ON" then
  p.setBundledOutput()
  energy = "OFF"
  sleep(1)
  clear()
  menu()
  menusel()
elseif input == "2" and onoff == " ON" and energy == "OFF" then
  p.setBundledOutput(onoffcolor, energycolor)
  energy = " ON"
  sleep(1)
  clear()
  menu()
  menusel()
elseif input == "2" and onoff == " ON" and energy == " ON" then
  p.setBundledOutput(onoffcolor)
  energy = "OFF"
  sleep(1)
  clear()
  menu()
  menusel()
else
  cprint("Seleccion incorrecta")
  sleep(1)
  clear()
  menu()
  menusel()
end
end
menu()
menusel()

strings are in spanish, dont give them attention, i have a problem with a pheripheral or the menusel() functio

They are diferent errors (2 diferent errors) here are some screenshots :

error 1: when i want to turn off the reactor energy / cutoff(energia saliente)


error 2: when i want to turn ON another output while one is ON:


Yes, i use extraperipherals mod from pzyber, it only adds 1 block, a Bundled Conector
that adds compatibility with redproject bundled cables and redlogic ones


Can someone please help me? i think the error is in p.setBundledOutput(onoffcolor, energycolor)

Thanks!
Lyqyd #2
Posted 12 January 2014 - 11:08 AM
You might double-check the usage. I think you need a side argument as well for that peripheral. You might also try asking in the peripheral's topic.
Moody #3
Posted 12 January 2014 - 12:26 PM
hey, first of all
p.setBundledOutput()
shouldnt work at all i think [line49]

also, usage of this function is:

setBundledOutput(string side, number colors )
but you do it like this:

p.setBundledOutput(onoffcolor, energycolor)
whicht should be

p.setBundledOutput(onoffcolor + energycolor)
Edited on 12 January 2014 - 11:29 AM
quique18c #4
Posted 12 January 2014 - 03:32 PM
hey, first of all
p.setBundledOutput()
shouldnt work at all i think [line49]

also, usage of this function is:

setBundledOutput(string side, number colors )
but you do it like this:

p.setBundledOutput(onoffcolor, energycolor)
whicht should be

p.setBundledOutput(onoffcolor + energycolor)

thanks man, it works! but it gaves to me error:50: 0 while turning off option 1 or 2, i corrected it, changing
p.setBundledOutput()
to
p.setBundledOutput(colors.brown)
, because i dont use brown, thanks!