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

[Lua] [Error] Please help

Started by mibac138, 20 November 2012 - 12:14 AM
mibac138 #1
Posted 20 November 2012 - 01:14 AM
Hey, I'm have an code and it's don't saying any error but it don't work please help.
Informations:
Code1(startup):

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

rs.setOutput("top", true)
mon = peripheral.wrap("back")
local function off()
  mon.clear()
  os.shutdown()
  rs.setOutput("top", false)
end
mon.setTextScale(2)
while true do
   if rs.getInput("left") == true then
	  off()
   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
  sleep(0.2)
end

picture:


If you can please help !

(I'm from poland and this is in Polish language.)
Orwell #2
Posted 20 November 2012 - 03:55 AM
Don't you mean that the monitor is on the other side, instead of the button?
mibac138 #3
Posted 20 November 2012 - 04:34 AM
no only code2

local function off()
  mon.clear()
  os.shutdown()
  rs.setOutput("top", false)
end
and

if rs.getInput("left") == true then
		  off()

(this code broken all other with the button i think :(/>/>)