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

Buttons not working!

Started by sgromila1, 31 July 2015 - 11:27 AM
sgromila1 #1
Posted 31 July 2015 - 01:27 PM
Buttons not working. No error message. Please help.



Spoiler

scp = setCursorPos
sbc = setBackgroundColor
stc = setTextColor
reactor = peripheral.wrap("BigReactors-Reactor_0")
monit = peripheral.wrap("right")
monit.setTextScale(1)
function rcs(stat,name,posY)
  monit.setCursorPos(1,posY)
  monit.write(name)
  monit.setTextColor(colors.yellow)
  statmin = math.floor(stat)
  monit.write(statmin)
  monit.setTextColor(colors.white)

  end  
function reactordata()
while true do

monit.clear()
monit.setCursorPos(1,1)
monit.write"Active:"  
if reactor.getActive() == true then
  monit.setCursorPos(8,1)
  monit.setTextColor(colors.lime)
  monit.write"ON"
end
if reactor.getActive() == false then
  monit.setCursorPos(8,1)
  monit.setTextColor(colors.red)
  monit.write"OFF"
end

monit.setTextColor(colors.white)

rcs(reactor.getNumberOfControlRods(),"Number of control rods:",2)
rcs(reactor.getEnergyStored(),"Stored energy (RF):",3)
rcs(reactor.getFuelTemperature(),"Fuel Temperature:",4)
rcs(reactor.getCasingTemperature(),"Casing Temperature:",5)
rcs(reactor.getFuelAmount(),"Fuel Amount:",6)
rcs(reactor.getWasteAmount(),"Waste Amount:",7)
rcs(reactor.getFuelAmountMax(),"Total capacity:",8)
rcs(reactor.getControlRodLevel(1),"Insertion of rod:",9)
rcs(reactor.getEnergyProducedLastTick(),"RF/t:",10)
rcs(reactor.getFuelReactivity(),"Fuel reactivity:",11)
rcs(reactor.getFuelConsumedLastTick(),"Fuel mb/t:",12)

monit.setBackgroundColor(colors.blue)
monit.setTextColor(colors.green)
monit.setCursorPos(1,14)
monit.write"ON"
monit.setBackgroundColor(colors.black)
monit.setCursorPos(13,14)
monit.setBackgroundColor(colors.blue)
monit.write"OFF"
monit.setBackgroundColor(colors.black)
monit.setCursorPos(1,16)
monit.setBackgroundColor(colors.blue)
monit.write"EJECT FUEL"
monit.setBackgroundColor(colors.black)
monit.setCursorPos(13,16)
monit.setBackgroundColor(colors.blue)
monit.write"EJECT WASTE"
monit.setBackgroundColor(colors.black)
monit.setCursorPos(1,18)
monit.setBackgroundColor(colors.blue)
monit.write"0102030405060708090"
monit.setBackgroundColor(colors.black)
monit.setTextColor(colors.white)
sleep(0.5)
end
end
function touchscreen()
while true do
event, side, x, y = os.pullEvent("monitor_touch")
print(event, side, x ,y )
if x > 0 and x < 3 and y == 14 then
  reactor.setActive(true)
  print"1"
end
if x > 12 and x < 16 and y == 14 then
  print"2"
  reactor.setActive(false)
end
if x > 0 and x < 10 and y == 16 then
  reactor.doEjectFuel()
  print"3"
end
if x > 12 and x < 24 and y == 16 then
  reactor.doEjectWaste()
  print"4"
end
sleep(0.5)

end
end  
parallel.waitForAny(reactordata(),touchscreen())
Edited by
KingofGamesYami #2
Posted 31 July 2015 - 04:47 PM
parallel takes functions for arguments, you may want to pass it something other than nil.


parallel.waitForAny( reactordata, touchscreen )