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

Need help program nill error

Started by Drazlak, 15 November 2014 - 06:43 AM
Drazlak #1
Posted 15 November 2014 - 07:43 AM
My computer craft program doesnt do what i want it to do can anyone help ill put a pastebin link bollow

Link : http://pastebin.com/StZHxWLR

and thank you for helping
Bomb Bloke #2
Posted 15 November 2014 - 08:12 AM
Currently, the script will wait for a redstone state change, then error out due to spelling mistakes.

This block here:

while true do
event = os.pullEvent()
if event == "redstone" then
break
end
end

… could be re-written as just:

os.pullEvent("redstone")

Combining that with fixes for the other errors, we'd get:

os.pullEvent("redstone")
peripheral.call("top", "write" , "Hello world")  -- Assuming a monitor is above, writes "Hello world" on that
sleep(10)
term.clearLine()  -- Clears the current line on the computer's own display
sleep(10)
term.setCursorPos(1,1)  -- Moves the cursor on the computer's own display

If this differs from what you "want", then it might pay to explain what exactly that is and what said differences are.