Tutotrial 1:
Spoiler
The first thing we are going to program is a simple door lock program. The most people that create this program haven’t programmed it themselves or they don’t understand it, so I will try to let you understand the code.
The first thing you should know is the commands for the terminal. You can see these commands by typing “help term”. This gives you list of commands you can use. In the list you will see “term.write()”. This will write some text on the screen. Something you should know is that you can’t type “term.write(Hello World!)”, you must type “term.write(“Hello World!”)” in order for it to work. Now look at some other functions in the list. Try to create a program with it. Here is an example of what you could make
term.clear()
term.write("Hello")
term.clear()
term.write("Who are you?")
term.clear()
When running this program you will notice that you don’t see any text. This is because the text disappears just after it appeared. To fix this you need the function “sleep(time)”.
term.clear()
term.write("Hello")
sleep(2)
term.clear()
term.write("Who are you?")
sleep(2)
term.clear()
Now you will notice something else. The text “Who are you?” appears at the wrong place! You can fix this by using the function “term.setCursorPos(x, y)”.
term.clear()
term.setCursorPos(1, 1)
term.write("Hello")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
term.write("Who are you?")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
Now you can create something cooler, by getting the input of the user. You can do this with the function “reatt()”. You can use this function by typing something like “input = read()” this puts what read returns into a variable called “input”. We’ll go over variables in another tutorial. Something
you should know about this function is that it will sleep until the user has entered some text. This is an example of how you can use “read()”
term.clear()term.setCursorPos(1, 1)
term.write("hello")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
term.write("Who are you?")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
input = read()
term.clear()
term.setCursorPos(1, 1)
term.write("Hello ")
term.write(input)
term.write("!")
sleep(5)
term.clear()
term.setCursorPos(1, 1)
Now type “help redstone”. You will see a list of functions. To make the computer/turtle output Redstone you need to use “rs.setOutput(“direction”, boolean)”. Now we can make a program that opens a door if you say your name:
term.clear()term.setCursorPos(1, 1)
term.write("hello")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
term.write("Who are you?")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
input = read()
term.clear()
term.setCursorPos(1, 1)
term.write("Hello ")
term.write(input)
term.write("!")
rs.setOutput("back", true)
sleep(5)
rs.setOutput("back", false)
term.clear()
term.setCursorPos(1, 1)
The first thing we are going to program is a simple door lock program. The most people that create this program haven’t programmed it themselves or they don’t understand it, so I will try to let you understand the code.
The first thing you should know is the commands for the terminal. You can see these commands by typing “help term”. This gives you list of commands you can use. In the list you will see “term.write()”. This will write some text on the screen. Something you should know is that you can’t type “term.write(Hello World!)”, you must type “term.write(“Hello World!”)” in order for it to work. Now look at some other functions in the list. Try to create a program with it. Here is an example of what you could make
term.clear()
term.write("Hello")
term.clear()
term.write("Who are you?")
term.clear()
When running this program you will notice that you don’t see any text. This is because the text disappears just after it appeared. To fix this you need the function “sleep(time)”.
term.clear()
term.write("Hello")
sleep(2)
term.clear()
term.write("Who are you?")
sleep(2)
term.clear()
Now you will notice something else. The text “Who are you?” appears at the wrong place! You can fix this by using the function “term.setCursorPos(x, y)”.
term.clear()
term.setCursorPos(1, 1)
term.write("Hello")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
term.write("Who are you?")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
Now you can create something cooler, by getting the input of the user. You can do this with the function “reatt()”. You can use this function by typing something like “input = read()” this puts what read returns into a variable called “input”. We’ll go over variables in another tutorial. Something
you should know about this function is that it will sleep until the user has entered some text. This is an example of how you can use “read()”
term.clear()term.setCursorPos(1, 1)
term.write("hello")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
term.write("Who are you?")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
input = read()
term.clear()
term.setCursorPos(1, 1)
term.write("Hello ")
term.write(input)
term.write("!")
sleep(5)
term.clear()
term.setCursorPos(1, 1)
Now type “help redstone”. You will see a list of functions. To make the computer/turtle output Redstone you need to use “rs.setOutput(“direction”, boolean)”. Now we can make a program that opens a door if you say your name:
term.clear()term.setCursorPos(1, 1)
term.write("hello")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
term.write("Who are you?")
sleep(2)
term.clear()
term.setCursorPos(1, 1)
input = read()
term.clear()
term.setCursorPos(1, 1)
term.write("Hello ")
term.write(input)
term.write("!")
rs.setOutput("back", true)
sleep(5)
rs.setOutput("back", false)
term.clear()
term.setCursorPos(1, 1)












