This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
How do I use paintutils in a monitor?
Started by PlotTwistGamer, 05 January 2018 - 01:48 AMPosted 05 January 2018 - 02:48 AM
I'm trying to make a button program and I don't know how to use paintutils on a monitor. Can someone help me? :D/>
Posted 05 January 2018 - 04:27 AM
Also, how do I set a specific line to have a color but no else?
Posted 05 January 2018 - 11:22 AM
You can wrap the monitor using peripheral.wrap:
If you want a line to be blue you can set the cursor position somewhere in that line and then call term.clearLine()
local mon = peripheral.wrap("back") --Replace back with the monitor side
And then use term.redirect:
term.redirect(mon)
This will redirect all term operations to the monitor.If you want a line to be blue you can set the cursor position somewhere in that line and then call term.clearLine()
Posted 05 January 2018 - 11:57 AM
If you want a line to be blue you can set the cursor position somewhere in that line and then call term.clearLine()
Remember to set the colour back after this else you'll keep using blue.
Posted 24 January 2018 - 01:18 AM
Another question, how do I make it so that if a computer senses a bundled cable current, it switches something. Such as if one of my computers were to turn on a reactor, how would I make it so that another computer automatically displays "REACTOR STATUS: ON". And once that computer stops transmitting the other one displays "REACTOR STATUS: OFF"
Edited on 24 January 2018 - 12:18 AM
Posted 24 January 2018 - 01:48 PM
You'll need your script to listen to redstone events and use testBundledInput to check if the color you want is active.
Posted 24 January 2018 - 11:14 PM
You'll need your script to listen to redstone events and use testBundledInput to check if the color you want is active.
… I don't know how to use this in the program I'm doing lol
EDIT: Plus this gives me no information on how to combine the two. Explain a little better?
Edited on 24 January 2018 - 10:31 PM
Posted 25 January 2018 - 01:12 AM
… I don't know how to use this in the program I'm doing lol
Yeah, I don't know either, mainly because I haven't seen said program.
EDIT: Plus this gives me no information on how to combine the two. Explain a little better?
The redstone event tells your program WHEN to update, testBundledInput tells you HOW. I assume you can handle writing to the monitor.
Posted 26 January 2018 - 12:00 AM
You'll need your script to listen to redstone events and use testBundledInput to check if the color you want is active.
… I don't know how to use this in the program I'm doing lol
EDIT: Plus this gives me no information on how to combine the two. Explain a little better?
Do you not know what os.pullEvent is? It's simply a function you call to get the next event, in this case a redstone event. It blocks the script until that event is found. So basically:
while true do
local isOn = redstone.testBundledInput('back', colors.red) --# assuming the cable is connected to the back of the computer and is colored red
term.setTextColor(colors.white)
term.setBackgroundColor(colors.black)
term.clear()
term.write('Redstone: ')
term.setTextColor(isOn and colors.green or colors.red) --# colors.green if isOn == true else colors.red
term.write(isOn and 'ON' or 'OFF') --# 'ON' if isOn == true else 'OFF'
local evt = os.pullEvent('redstone') --# this line will block until a redstone input changes, then the loop will restart
end
That script is untested, but I think it'll work (written in the post editor, too lazy to start up Minecraft and make a setup right now)