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

Redstone Input triggering a printer?

Started by Tassyr, 29 March 2013 - 10:48 PM
Tassyr #1
Posted 29 March 2013 - 11:48 PM
So, long story short, title. I'm trying to figure how to do something- I have a computer system that outputs a redstone signal every time it's triggered. I suddenly realized I should be able to use this to make a logger- to tell when this system (a large door) was opened or closed.

Catch is… I'm stumbling. My plan was to have the printer tag each line with "X was activated on X time," Then go to the next line, until the page is full, then start another… I'm running into a brick wall, and I've completely scrapped my original idea. Is there a tutorial I should be looking at?
Mads #2
Posted 30 March 2013 - 12:16 AM
You can do something like this:


while true do
    local ev = os.pullEvent("redstone");
    -- Do stuff(this will be run when the computer receives a redstone signal)
end
Tassyr #3
Posted 30 March 2013 - 12:22 AM
Erm, I got that part working- sorry, blame sleep dep for my vagueness. What I mean is how do I get the printer to not run off the end of the page as if drunk? And how do I get the printer to print happily? I can get the info to show on the SCREEN but not on the printer happily.

I can get it to print ONE line to a printer page, but I can't get this effect:
"Circuit was triggered at X"

"Circuit was triggered at X"

"Circuit was triggered at X"

"Circuit was triggered at X"

"Circuit was triggered at X"

*NEW PAGE*


"Circuit was triggered at X"
remiX #4
Posted 30 March 2013 - 01:22 AM
Have a variable count how many times it has printed the text and then:


if times % 5 == 0 then
    printer.newPage()
end

Will just make the printer have a new page every 5 times