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

[Java&Lua][Error] Very mouch errors please help

Started by mibac138, 20 November 2012 - 05:53 AM
mibac138 #1
Posted 20 November 2012 - 06:53 AM
Can you help me with this? look

code1(startup):

while true do
   if rs.getInput("left") == true then
	shell.run("st")
   end
   sleep(0)
end

code2(the problem-monitor menu):

rs.setOutput("top", true)
mon = peripheral.wrap("back")
mon.setTextScale(2)
while true do
  if rs.getInput("left") == true then
	  rs.setOutput("top", false)
	  mon.clear()
	  shell.run("startup")
   end
   rin = rs.getBundledInput( "front" )
  if colors.test( rin, colors.lime) == true then
	  mon.setCursorPos(1,1)
	  mon.clearLine()
	  mon.write("Zasilanie: 100%")
	 elseif colors.test( rin, colors.yellow) == true then
	  mon.setCursorPos(1,1)
	  mon.clearLine()
	  mon.write("Zasilanie: 75%")
	 elseif colors.test( rin, colors.lightBlue) == true then
	  mon.setCursorPos(1,1)
	  mon.clearLine()
	  mon.write("Zasilanie: 50%")
	 elseif colors.test( rin, colors.magenta) == true then
	  mon.setCursorPos(1,1)
	  mon.clearLine()
	  mon.write("Zasilanie: 25%")
	else
	  mon.setCursorPos(1,1)
	  mon.clearLine()
	  mon.write("Zasilanie: 0%")
   end
  if colors.test( rin, colors.white) == true then
	 mon.setCursorPos(1,2)
	 mon.clearLine()
	 mon.write("Quarry: Wlaczone")
	else
	 mon.setCursorPos(1,2)
	 mon.clearLine()
	 mon.write("Quarry: Wylaczone")
   end
  if colors.test( rin, colors.pink) == true then
	 mon.setCursorPos(1,3)
	 mon.clearLine()
	 mon.write("Rafineria: Wlaczona")
	else
	 mon.setCursorPos(1,3)
	 mon.clearLine()
	 mon.write("Rafineria: Wylaczona")
   end
end

Errors(after changing things in monitor menu):


THIS CODE IS IN POLISH LANGUAGE


WORKING I'M FIXED THIS :(/>/>
Doyle3694 #2
Posted 20 November 2012 - 07:12 AM
I think of stack overflow, since your programs are refering to each other. note that if the redstone is on to the left, it will in a couple of seconds get a stackoverflow because this happends fast. your last error, is because your while true loop is missing a sleep(0) at the end, so it wont yield
billysback #3
Posted 20 November 2012 - 07:47 AM
I've never seen this kind of error however, are you spamming new variables?
If so then that may explain the index-out-of-bounds as Java may be struggling to keep up, trying to look for values in arrays which are not yet there.