Posted 26 April 2014 - 05:27 PM
Hey Forum,
I've a question about a CC Program by me to Control my Nuclear Reaktor's with CC. I will turn out a rs Output with a Touchpad. But when i click on my monitor, it doesn't work.
Im sorry for my bad english, i hope you understand me!
Here The Code:
You can ignore my personal notices.
Thanks for help
I've a question about a CC Program by me to Control my Nuclear Reaktor's with CC. I will turn out a rs Output with a Touchpad. But when i click on my monitor, it doesn't work.
Im sorry for my bad english, i hope you understand me!
Here The Code:
-- Anfang Einstellungen --
monitor = peripheral.wrap("top")
monitor.setTextScale(1)
monitor.setTextColor(colors.lime)
monitor.clear()
-- Ende Einstellungen --
-- Anfang Layout --
monitor.setCursorPos(1,2)
monitor.write("==================================================")
monitor.setCursorPos(1,10)
monitor.write("--------------------------------------------------")
monitor.setCursorPos(1,18)
monitor.write("==================================================")
monitor.setCursorPos(26,3)
monitor.write("-")
monitor.setCursorPos(1,4)
monitor.write("--------------------------------------------------")
monitor.setCursorPos(26,5)
monitor.write("-")
monitor.setCursorPos(26,6)
monitor.write("-")
monitor.setCursorPos(26,7)
monitor.write("-")
monitor.setCursorPos(26,8)
monitor.write("-")
monitor.setCursorPos(26,9)
monitor.write("-")
monitor.setCursorPos(26,11)
monitor.write("-")
monitor.setCursorPos(26,12)
monitor.write("-")
monitor.setCursorPos(26,13)
monitor.write("-")
monitor.setCursorPos(26,14)
monitor.write("-")
monitor.setCursorPos(26,15)
monitor.write("-")
monitor.setCursorPos(1,16)
monitor.write("--------------------------------------------------")
monitor.setCursorPos(26,17)
monitor.write("-")
-- Ende Layout --
-- Anfang Inhalt --
monitor.setCursorPos(9,3)
monitor.write("Reaktor 1")
monitor.setCursorPos(35,3)
monitor.write("Reaktor 2")
monitor.setCursorPos(9,17)
monitor.write("Reaktor 3")
monitor.setCursorPos(35,17)
monitor.write("Reaktor 4")
-- Ende Inhalt --
-- Anfang Buttons --
monitor.setBackgroundColor(colors.orange)
monitor.setTextColor(colors.black)
monitor.setCursorPos(8,7)
monitor.write(" ON / OFF ")
monitor.setCursorPos(34,7)
monitor.write(" ON / OFF ")
monitor.setCursorPos(8,13)
monitor.write(" ON / OFF ")
monitor.setCursorPos(34,13)
monitor.write(" ON / OFF ")
monitor.setBackgroundColor(colors.black)
monitor.setTextColor(colors.lime)
monitor.setCursorPos(1,1)
-- Ende Buttons --
-- Anfang der Click Funktion --
mouseWidth = 0
mouseHeight = 0
function checkClickPosition()
if mouseWidth > 8 and mouseWidth < 18 and mouseHeight == 7 then
rs.setBundledOutput("back", colors.red)
sleep(1)
rs.setBundledOutput("back", colors.black)
elseif mouseWidth > 34 and mouseWidth < 44 and mouseHeight == 7 then
rs.setBundledOutput("back", colors.blue)
sleep(1)
rs.setBundledOutput("back", colors.black)
elseif mouseWidth > 8 and mouseWidth < 18 and mouseHeight == 13 then
rs.setBundledOutput("back", colors.green)
sleep(1)
rs.setBundledOutput("back",colors.black)
elseif mouseWidth > 34 and mouseWidth < 44 and mouseHeight == 13 then
rs.setBundledOutput("back", colors.yellow)
sleep(1)
rs.setBundledOutput("back",colors.black)
end
end
-- Ende der Click Funktion --
-- Anfang der Click Einstellungen --
repeat
event,p1,p2,p3 = os.pullEvent()
if event == "monitor_touch" then
mouseWidth = p2
mouseHeight = p3
checkClickPosition()
end
until event == "char" and p1 == ("x")
-- Ende der Click Einstellungen --
w,h=monitor.getSize()
print(w)
print(h)
You can ignore my personal notices.
Thanks for help