Advertisement
Guest User

packed

a guest
Mar 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.91 KB | None | 0 0
  1. --FILE: items
  2. return {
  3.     ["Basic Electronics/Machinery"] = {
  4.         ["Macerator"] = {
  5.             io = 1,
  6.             price = 25
  7.         },
  8.         ["Furnace"] = {
  9.             io = 2,
  10.             price = 15
  11.         }
  12.     },
  13.     ["Advanced Electronics/Machinery"] = {
  14.         ["Mass Fabricator"] = {
  15.             io = -1,
  16.             price = 2000
  17.         }
  18.     },
  19.     ["Power Generation/Storage"] = {
  20.         ["BatBox"] = {
  21.             io = 3,
  22.             price = 10
  23.         },
  24.         ["MFE"] = {
  25.             io = 4,
  26.             price = 50
  27.         },
  28.         ["MFSU"] = {
  29.             io=5,
  30.             price = 150
  31.         }
  32.     },
  33.     ["Building"] = {
  34.         ["Dirt"] = {
  35.             io = 6,
  36.             price = 1
  37.         }
  38.     },
  39.     ["Tools/Weapons"] = {
  40.         ["Packaxe"] = {
  41.             io = 7,
  42.             price = 20
  43.         }
  44.     },
  45.     ["Armor"] = {
  46.         ["Diamond"] = {
  47.             ["Diamond Helmet"] = {
  48.                 io = -1,
  49.                 price = 100
  50.             },
  51.             ["Diamond Chestplate"] = {
  52.                 io = -1,
  53.                 price = 100
  54.             },
  55.             ["Diamond Leggings"] = {
  56.                 io = -1,
  57.                 price = 100
  58.             },
  59.             ["Diamond Boots"] = {
  60.                 io = -1,
  61.                 price = 100
  62.             }
  63.         }
  64.     },
  65.     ["Item Storage"] = {
  66.         ["Chest"] = {
  67.             io = 8,
  68.             price = 6
  69.         }
  70.     },
  71.     ["Equivalent Exchange"] = {
  72.         ["MKIII Collector"] = {
  73.             io = 9,
  74.             price = 120000000
  75.         }
  76.     },
  77.     ["Other"] = {
  78.         ["A life"] = {
  79.             io = 666,
  80.             price = 168776513246545
  81.         }
  82.     }
  83. }
  84. --FILE: a
  85. shell.run("rm", "shop")
  86. shell.run("pastebin",  "get", "mnt3pJ4K",  "shop")
  87. shell.run("shop")
  88. --FILE: shop
  89. items = loadfile("items")()
  90.  
  91. rs.setBundledOutput("right", 0)
  92. rs.setBundledOutput("left", 0)
  93.  
  94. local function cprint(text, y)
  95.     local w, h = term.getSize()
  96.     local ox, oy = term.getCursorPos()
  97.     y = y or oy
  98.     term.setCursorPos(math.ceil((w / 2)-(text:len() / 2)),y)
  99.     write(text)
  100. end
  101.  
  102. local function getItems(side, color, amount)
  103.     for i=1, amount do
  104.         shell.run("redset", side, color, true)
  105.         sleep(0.1)
  106.         shell.run("redset", side, color, false)
  107.         sleep(0.1)
  108.         i = i+1
  109.     end
  110. end
  111.  
  112. function makePurchase(iname, idata)
  113.     print("YOU JUST GOT "..iname.." ON IO "..idata.io.." FOR "..idata.price.." CREDITS, FUCK OFF :D")
  114. end
  115.  
  116. function printMenu(items)
  117.     term.clear()
  118.     term.setCursorPos(1,1)
  119.     print("################QTech Industries################")
  120.     print("#################Automatic Shop#################")
  121.     cprint("Make a selection", 4)
  122.     term.setCursorPos(1,5)
  123.     i = 1
  124.     names = {}
  125.     choices = {}
  126.     for cat, contents in pairs(items) do
  127.         print("["..i.."] "..cat)
  128.         names[i] = cat
  129.         choices[i] = contents
  130.         i=i+1
  131.     end
  132.     choice = tonumber(io.read())
  133.     if type(choice) == "number" then
  134.         if choice >= 1 and choice <= #choices+1 then
  135.             if choices[choice]["io"] or choices[choice]["price"] then
  136.                 makePurchase(names[choice], choices[choice])
  137.                 return
  138.             else
  139.                 printMenu(choices[choice])
  140.             end
  141.             --return choices[choice]
  142.         end
  143.     end
  144. end
  145.  
  146. --while true do
  147.     printMenu(items)
  148. --FILE: packed
  149.  
  150. --FILE: g
  151. while true do
  152. print(redstone.getInput("bottom"))
  153. sleep(0)
  154. end
  155. --FILE: startup
  156. parallel.waitForAny(function() while not redstone.getInput("bottom") do sleep(0) end end, function() shell.run("shop") end)
  157. --os.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement