Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --turns your turtle into a dj :3
- --Variables--
- local fDiscs = 0 --nr of found discs
- --discs: nr, name, namelength, found, turtleslot
- local discs = {}
- --tSides: sides turtle can suck/drop stuff
- local tSides = {"top","front","bottom"}
- --discNames: all vanilla music discs
- local discNames = {{name = "13" },
- {name = "cat" },
- {name = "blocks" },
- {name = "chirp" },
- {name = "far" },
- {name = "mall" },
- {name = "mellohi"},
- {name = "stal" },
- {name = "strad" },
- {name = "ward" },
- {name = "11" },
- {name = "wait" }}
- local error = "\nYour momma"
- --Peripheral Setup--
- --Monitor
- local mon, mon2 = peripheral.find("monitor", function(name, object) return object.isColor() end)
- assert(mon,"No advanced monitor found"..error)
- assert(not mon2,"Multiple advanced monitors found"..error)
- mon.setTextScale(.5)
- local mW, mH = mon.getSize()
- print(mW.." - "..mH) --test
- --Disk Drive
- -->hier<--
- --Chest
- --Functions--
- -- sorting/filling/resetting discs table
- local function sortDiscs()
- discs = discNames
- local dump = true
- for h=1,12 do
- discs[h]["found"] = false
- end
- for i=1,16 do
- local item = turtle.getItemDetail(i)
- if item ~= nil then
- -- get id
- local id = string.sub(item.name,18)
- -- compare to table
- for j=1,12 do
- if id == discs[j]["name"] then
- -- safe it from being dumped
- dump = false
- if not discs[j]["found"] then
- discs[j]["found"] = true
- discs[j]["tslot"] = i
- discs[j]["nlen"] = string.len(discs[j]["name"])
- fDiscs = fDiscs + 1
- else
- turtle.select(i)
- turtle.dropUp()
- turtle.select(1)
- end
- end
- end
- if dump then
- turtle.select(i)
- turtle.dropUp()
- turtle.select(1)
- end
- dump = true
- end
- end
- end
- sortDiscs() --test
- print(textutils.serialize(discs[11])) -- table test
- for i=1,fDiscs do
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement