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

2 Problems With Redstone Activated Program

Started by loldudester, 18 December 2012 - 01:36 PM
loldudester #1
Posted 18 December 2012 - 02:36 PM
I've got a program that downloads 10 lines of text from a chat log on another server, which works fine.
I made the script loop by adding
"while true do
sleep(5)"
While this makes it repeat fine, I need a way to make the screen clear before it loops, as sometimes the old print is left on the screen above the new one.
The second thing I need is a way to activate it with a redstone pulse. I had a way to do it, which I put in the startup file, but after that I couldn't do anything else on the computer, and since it was labeled, I had to scrap it.
I've now had the bright idea of running it from a disk, but I can't for the life of me remember the code.
remiX #2
Posted 18 December 2012 - 02:48 PM
To clear the screen use this:
term.clear()
term.setCursorPos(1,1) -- reset the cursor position

To activiate something with a redstone single use os.pullEvent("redstone"):


os.pullEvent("redstone")  -- will only continue when there is a redstone signal
-- code
loldudester #3
Posted 19 December 2012 - 04:49 AM
Would the redstone bit have to go into a file running in the background, like startup?
And would that file run fine from a floppy disk?

EDIT: Nevermind, got it working!