Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touchpoint")
- local chest = peripheral.wrap("back")
- local t = touchpoint.new("left")
- local mon = peripheral.wrap("left")
- local contents = chest.getAllStacks(false)
- local x,y = mon.getSize()
- local left_margin1 = 2;
- local left_margin2 = math.floor(x/2-1);
- local right_margin1 =math.floor(x/2+1);
- local right_margin2 = x-1;
- local rows = (y-2)/2
- local books = {}
- function newBook(name,slot)
- local object = {}
- object.name = name
- if slot < 1 then
- object.slot = 0
- else
- object.slot = slot
- end
- if slot<=rows then
- index = slot-1;
- t:add(name,nil,left_margin1,2+((2*index)+1),left_margin2,2+((2*index)+1),colors.red,colors.lime)
- elseif slot<=(rows*2) then
- index = (slot-7)-1;
- t:add(name,nil,right_margin1,2+((2*index)+1),right_margin2,2+((2*index)+1),colors.red,colors.lime)
- end
- return object
- end
- function setTitle(str)
- x,y = mon.getSize()
- mon.clear()
- startPt = (x-#str)/2
- mon.setCursorPos(x-startPt,1)
- mon.setTextScale(1)
- mon.write(str)
- end
- print(rows)
- for i=1,#contents do
- local name = contents[i].myst_book.destination
- local slot = i
- print(name .. " " .. slot)
- books[i] = newBook(name,slot)
- end
- t:draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement