View difference between Paste ID: kUd02EEA and YzMVdMVp
SHOW: | | - or go back to the newest paste.
1
function checkBlock()
2
    local bool, data = turtle.inspect()
3
    while not bool do
4
        turn("r")
5
        bool, data = turtle.inspect()
6
    end
7-
    print(data.name)
7+
8-
    print("parsing")
8+
9
10
function parseNotes(data)
11
    song = fs.open("song","a")
12
    song.writeLine(data.state.instrument..":"..data.state.note)
13
    turtle.dig()
14
    turtle.forward()
15
    turn("l")
16
    local bool, data1 = turtle.inspect()
17
    if (bool) then
18
        song.writeLine(data1.state.instrument..":"..data1.state.note)
19
    end
20
    turn("r")
21
    turn("r")
22
    local bool1, data2 = turtle.inspect()
23
    if (bool1) then
24
        song.writeLine(data2.state.instrument..":"..data2.state.note)
25
    end
26
    song.close()
27
    turn("l")
28
end
29
30
function parseBlock(data)
31
    if(data.name == "minecraft:repeater") then
32
        song = fs.open("song", "a")
33-
    print(data.name)
33+
34-
    print(tostring(data.name == "minecraft:redstone_wire"))
34+
35-
    if (data.name == "minecraft:redstone_wire") then
35+
36-
        print("im in")
36+
37
    elseif(data.name == "minecraft:note_block") then
38
        parseNotes(data)
39-
    elseif(data.name == "minecraft:repeater") then
39+
    else
40
		turtle.dig()
41
        turtle.forward()
42
	end
43
end
44
45
function turn(dir)
46
    if(dir == "r")then
47
        turtle.turnRight()
48
    elseif(dir == "l")then
49
        turtle.turnLeft() 
50
    end
51
end
52
53
while true do
54
  checkBlock()
55
end