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

Train detection and status

Started by Laur47, 03 February 2018 - 08:40 AM
Laur47 #1
Posted 03 February 2018 - 09:40 AM
Hello there!

I'm trying to make a program which prints: "Train is here" when the cart activates the Detector Rail. I managed to make it do that, but the message stays onscreen even when the cart is gone, and i don't know how to make it disappear and reappear when the cart is back.
This is my code:

while true do
os.pullEvent('redstone')
if redstone.getInput('back') ==true then
print('Train!')

end
end
Jummit #2
Posted 03 February 2018 - 12:54 PM
What you need is the term api;
With term.setBackgroundColor(color)
and term.setTextColor(color) you can make the 'Train!' message look cooler. That only works if you use a golden computer though.
term.clear() fills the whole screen with the set background color.
Edited on 03 February 2018 - 11:55 AM