Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m = peripheral.wrap("top")
- m.clear()
- sl = 0
- function check()
- if sl >= 17 then
- sl = sl-1
- end
- sl = sl+1
- if sl <= 16 then
- turtle.select(sl)
- while turtle.getItemSpace() ~= 0 and sl <= 16 do
- sl = sl+1
- if sl <= 16 then
- turtle.select(sl)
- end
- end
- if turtle.getItemSpace() == 0 then
- det = turtle.getItemDetail().name
- end
- end
- end
- function fillTable()
- check()
- print(det)
- if sl <= 16 then
- but1n, but1s = show(), turtle.getSelectedSlot()
- button.setTable(but1n, d1, 3,38,3,3)
- end
- check()
- print(det)
- if sl <= 16 then
- but2n = show()
- button.setTable(but2n, d2, 3,38,4,4)
- but2s = turtle.getSelectedSlot()
- end
- check()
- print(det)
- if sl <= 16 then
- but3n = show()
- button.setTable(but3n, d3, 3,38,5,5)
- but3s = turtle.getSelectedSlot()
- end
- check()
- print(det)
- if sl <= 16 then
- but4n = show()
- button.setTable(but4n, d4, 3,38,6,6)
- but4s = turtle.getSelectedSlot()
- end
- check()
- print(det)
- if sl <= 16 then
- but5n = show()
- button.setTable(but5n, d5, 3,38,7,7)
- but5s = turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but6n = show()
- button.setTable(but6n, d6, 3,38,8,8)
- but6s = turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but7n = show()
- button.setTable(but7n, d7, 3,38,9,9)
- but7s = turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but8n, but8s = show(), turtle.getSelectedSlot()
- button.setTable(but8n, d8, 3,38,10,10)
- end
- check()
- if sl <= 16 then
- but9n = show()
- button.setTable(but9n, d9, 3,38,11,11)
- but9s = turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but10n = show()
- button.setTable(but10n, d10, 3,38,12,12)
- but10s = turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but11n = show()
- button.setTable(but11n, d11, 3,38,13,13)
- but11s = 0+turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but12n = show()
- button.setTable(but12n, d12, 3,38,14,14)
- but12s = 0+turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but13n = show()
- button.setTable(but13n, d13, 3,38,15,15)
- but13s = 0+turtle.getSelectedSlot()
- end
- check()
- if sl <= 16 then
- but14n = show()
- but14s = turtle.getSelectedSlot()
- button.setTable(but14n, d14, 3,38,16,16)
- end
- check()
- if sl <= 16 then
- but15n = show()
- but15s = turtle.getSelectedSlot()
- button.setTable(but15n, d15, 3,38,17,17)
- end
- check()
- if sl <= 16 then
- but16n = show()
- but16s = turtle.getSelectedSlot()
- button.setTable(but16n, d16, 3,38,18,18)
- end
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- function d1()
- button.flash(but1n)
- turtle.select(but1s)
- dj()
- end
- function d2()
- button.flash(but2n)
- turtle.select(but2s)
- dj()
- end
- function d3()
- button.flash(but3n)
- turtle.select(but3s)
- dj()
- end
- function d4()
- button.flash(but4n)
- turtle.select(but4s)
- dj()
- end
- function d5()
- button.flash(but5n)
- turtle.select(but5s)
- dj()
- end
- function d6()
- button.flash(but6n)
- turtle.select(but6s)
- dj()
- end
- function d7()
- button.flash(but7n)
- turtle.select(but7s)
- dj()
- end
- function d8()
- button.flash(but8n)
- turtle.select(but8s)
- dj()
- end
- function d9()
- button.flash(but9n)
- turtle.select(but9s)
- dj()
- end
- function d10()
- button.flash(but10n)
- turtle.select(but10s)
- dj()
- end
- function d11()
- button.flash(but11n)
- turtle.select(but11s)
- dj()
- end
- function d12()
- button.flash(but12n)
- turtle.select(but12s)
- dj()
- end
- function d13()
- button.flash(but13n)
- turtle.select(but13s)
- dj()
- end
- function d14()
- button.flash(but14n)
- turtle.select(but14s)
- dj()
- end
- function d15()
- button.flash(but15n)
- turtle.Select(but15s)
- dj()
- end
- function d16()
- button.flash(but16n)
- turtle.select(but16s)
- dj()
- end
- function dj()
- turtle.drop()
- sleep(0,5)
- rs.setOutput("front", true)
- sleep(0,5)
- rs.setOutput("front", false)
- turtle.suck()
- end
- function show()
- string = turtle.getItemDetail().name
- result = split(string,":")
- result[2] = string.gsub(result[2],"record_","")
- result[2] = string.gsub(result[2],"RecordWantYouGone","Want You Gone")
- result[2] = string.gsub(result[2],"RecordRadioLoop","Radio Loop")
- result[2] = string.gsub(result[2],"RecordStillAlive","Still ALive")
- result[2] = string.gsub(result[2],"recordGaia1","Endure Emptiness")
- result[2] = string.gsub(result[2],"recordGaia2","Fight For Quiescence")
- return result[2]
- end
- function split(str, pat)
- local t = {} -- NOTE: use {n = 0} in Lua-5.0
- local fpat = "(.-)" .. pat
- local last_end = 1
- local s, e, cap = str:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(t,cap)
- end
- last_end = e+1
- s, e, cap = str:find(fpat, last_end)
- end
- if last_end <= #str then
- cap = str:sub(last_end)
- table.insert(t, cap)
- end
- return t
- end
- fillTable()
- button.heading("Jukbox list")
- print(but1s)
- print(but2s)
- print(but3s)
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment