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

I dont know about repeat and until

Started by rootdoom33, 15 February 2015 - 08:11 PM
rootdoom33 #1
Posted 15 February 2015 - 09:11 PM
Okay so i have this command


redstone.setOutput("right", true)
os.sleep(1)
redstone.setOutput("right", false)


how do i repeat this?
Lignum #2
Posted 15 February 2015 - 10:03 PM
Judging by the title I assume you want repeat/until to be used for this?

local myVar = false
repeat
   rs.setOutput("right", true)
   os.sleep(1)
   rs.setOutput("right", false)
until myVar

This will repeat until you set 'myVar' to true. If you don't want it to stop you can just do this:

repeat
   --# ...
until false
Bomb Bloke #3
Posted 15 February 2015 - 10:04 PM
See this guide for more info.

Bear in mind you probably don't want to turn redstone back on within the instant you turn it off. Consider using a second sleep call.
rootdoom33 #4
Posted 15 February 2015 - 10:06 PM
Okay another question how do i paste it to my computer when ever i do it just gives me
local myVar = fals
KingofGamesYami #5
Posted 16 February 2015 - 05:18 PM
Pastebin is commonly used to place code on computers, another way is to find the file on your actual computer and paste the code there. It should be located in your world folder, under computers, under the folder that is the id of the computer you wish to put it on.
rootdoom33 #6
Posted 16 February 2015 - 05:34 PM
also another question how do i clear monitor text i got this
redstone.setOutput("left", true)
os.sleep(1)
os.sleep(1)
redstone.setOutput("left", false)
local monitor = peripheral.wrap("top")
monitor.write("opened door")

how do i clear the text that i wrote?
KingofGamesYami #7
Posted 16 February 2015 - 06:10 PM
monitor.clear()