Advertisement
Vodka51200

affichage contenu turtle

Jun 17th, 2017 (edited)
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. while true do
  2.  
  3. --term.clear()
  4. local items = {}
  5. local max = 16
  6.  
  7. local function getItems(items, max)
  8.   for slot = 1, max do
  9.     if turtle.getItemDetail(slot) ~= nil then
  10.       scan = turtle.getItemDetail(slot)
  11.      
  12.       if items[scan.name] == nil then
  13.         items[scan.name] = 0
  14.       end
  15.      
  16.       items[scan.name] = items[scan.name] + scan.count
  17.     end
  18.   end
  19. end
  20. local function displayItems(items, monitor) -- side
  21.   monitor = peripheral.find("monitor") -- side
  22.   term.redirect(monitor) -- dernier ajout
  23.   --term.setBackgroundColor(colors.blue)
  24.   term.setPaletteColour(colors.yellow, 0x018281) -- win 95/98
  25.   term.setBackgroundColor(colors.yellow)
  26.   monitor.setTextScale(0.5)
  27.   term.setCursorPos(1,1)
  28.   term.clear()
  29.   for k,v in pairs(items) do
  30.     if k == "minecraft:ancient_debris" then
  31.     monitor.setTextColor(colors.brown)
  32.     k = "ancient_debris"
  33.     print(k.." x"..v)
  34.     elseif k == "allthemodium:allthemodium_ore" then
  35.     monitor.setTextColor(colors.orange)
  36.     k = "allthemodium"
  37.     print(k.." x"..v)
  38.     elseif k == "allthemodium:vibranium_ore" then
  39.     monitor.setTextColor(colors.green)
  40.     k = "vibranium"
  41.     print(k.." x"..v)
  42.     elseif k == "allthemodium:unobtainium_ore" then
  43.     monitor.setTextColor(colors.purple)
  44.     k = "unobtainium"
  45.     print(k.." x"..v)
  46.     elseif k == "tconstruct:cobalt_ore" then
  47.     monitor.setTextColor(colors.cyan)
  48.     k = "cobalt_ore"
  49.     print(k.." x"..v)
  50.     else
  51.     --monitor.setTextColor(colors.white)
  52.     term.setPaletteColour(colors.white, 0x999966)
  53.     term.setTextColour(colors.white)
  54.  
  55.     print(k.." x"..v)
  56.     end
  57.   end
  58. end
  59.  
  60. getItems(items, max)
  61. displayItems(items, monitor) -- "top"
  62. sleep(0.5)
  63. end
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement