Advertisement
rhn

ItemSortStore monitor

rhn
Mar 25th, 2020
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. MonitorSide=detectDevice("monitor")
  2. if MonitorSide~="none" then
  3.     monitor=peripheral.wrap(MonitorSide)
  4.     print ("Monitor on the " .. MonitorSide .. " connected.")
  5. else
  6.     for Index = 1, #peripheralList do
  7.         if string.find(peripheralList[Index], "monitor") then
  8.             monitor=peripheral.wrap(peripheralList[Index])
  9.             print ("Monitor on wired modem: "..peripheralList[Index].." connected.")
  10.         end
  11.     end --for
  12.     if monitor == "none" then
  13.         print ("Warning - No Monitor attached, continuing without.")
  14.     end
  15. end
  16.  
  17. w,h=monitor.getSize()
  18. print(w)
  19. print(h)
  20. stockcount=1
  21. stocklist={}
  22. stockamount={}
  23. for i=1,#itemMapName do
  24.     for j=1,#itemMapName[1] do
  25.         stocklist[stockcount]=itemMapDisplay[i][j]
  26.         stockamount[stockcount]=itemMapCount[i][j]
  27.         stockcount=stockcount+1
  28.     end
  29. end
  30.  
  31. --------Sorter???
  32. monitor.clear()
  33. monitor.setTextColor(1)
  34. for i=1,math.min(h,math.floor(#stocklist/2)) do
  35.     monitor.setCursorPos(1,i)
  36.     monitor.write(stocklist[i].." "..stockamount[i])
  37. end
  38. if #stocklist>h then
  39. for i=1,h do
  40.     monitor.setCursorPos(math.floor(w/2)+1,i)
  41.     monitor.write(stocklist[i+h].." "..stockamount[i+h])
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement