local monitor = peripheral.wrap("back"
while true do
if os.pullEvent("redstone") then
if rs.getBundledInput("right", colours.white) then
monitor.write("Lights Toggled")
end
end
end
Edit: Im new to coding so im really bad right now :(/>
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Bundled Cable Input Dection
Started by Darth_Ben17, 22 October 2013 - 11:24 PMPosted 23 October 2013 - 01:24 AM
Hey guys, lately ive been attempting to make a monitor write "Lights Toggled" when the computer receives an input from Bunled Cable (white). Here is my code so far but it writes "Lights Toggled" when any colour goes on.
Posted 23 October 2013 - 02:23 AM
Almost. Just make it remember if the white cable is on or not, and check if that changed in every redstone event:
local monitor = peripheral.wrap("back")
local last = rs.testBundledInput("right", colours.white)
while true do
if os.pullEvent("redstone") then
local current = rs.testBundledInput("right", colours.white)
if last ~= current then
last = current
monitor.write("Lights Toggled")
end
end
end
Posted 23 October 2013 - 02:38 AM
Thnx that will work perfectly im new too coding (as a said) so im just getting it now :lol:/>
Posted 23 October 2013 - 02:40 AM
Also there was just one thing, I was testing some codes and I got some error and it said 30 in red, do u know what this means?
Posted 23 October 2013 - 04:36 AM
30? Was that the whole error message?!
Posted 23 October 2013 - 04:47 PM
That was the whole error and I sometimes get it when I do ctrl+T instead of terminate its weird
Posted 23 October 2013 - 05:22 PM
Are you sure it's an error, then? Given that it's solely a number and doesn't mention the term "error" at all, it's probably something specifically generated by your code.
That, or there is indeed more to the message then that. For what it's worth, most times you see a number within an error message, that number refers to the line number where the error occurred.
That, or there is indeed more to the message then that. For what it's worth, most times you see a number within an error message, that number refers to the line number where the error occurred.
Posted 24 October 2013 - 02:17 AM
Yeah I know that but it hasn't been coming up since I redid my code so ill tell you if I see it again