Advertisement
SpitefulJames

Dailer MK1.lua

Apr 20th, 2021
968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. os.loadAPI("buttonGui")
  2.  
  3. ButtonGui.addButton("Old Base",old_base,xmin,xmax,ymin,ymax,idleColor,activeColor) --Adds buttons using buttonGui table
  4. ButtonGui.screenButton() --Adds buttons to monitor
  5.  
  6.  
  7. function getClick() -- Player interacting with monitor buttons.
  8.     event,side,x,y = os.pullEvent("monitor_touch")
  9.     buttonGui.checkxy(x,y)
  10. end
  11.  
  12. --find peripherals
  13. pChest = waitforPeripheral('chest')
  14. pMonitor = waitforPeripheral('monitor')
  15. pMusic = waitforPeripheral('note_block')
  16.  
  17. function waitforPeripheral(type)
  18.     unit = nil
  19.     repeat
  20.         unit = peripheral.find(type)
  21.         if (unit ==nil) then
  22.             if (pMusic ~= nil) then
  23.                 pMusic.playSound('mob.villager.hurt', 1, 1)
  24.             end
  25.         print("Searching for",type)
  26.         sleep(2.5)
  27.         end
  28.     until unit ~= nil
  29.     return unit
  30. end
  31.  
  32. function itemDetection() --Find out what the item is
  33.     stacks = pChest.getAllStacks()
  34.     for slot, stack in pairs(stacks) do
  35.         if (stack.all ~= nil) then
  36.             stack = stack.all()
  37.         end
  38.         if (stack.name == "teleporterMKI") then
  39.             print(stack.display_name)
  40.         else
  41.             error("Could not find Dislocators...")
  42.         end
  43.     end
  44. end
  45. function old_base()
  46.     local stack == itemDetection()
  47.     if stack == "Old Base" then
  48.         buttonGui.flash()
  49.         print("Old Base selected!")
  50.         recSwap()
  51.     else
  52. end
  53. end
  54.  
  55. function recSwap() --Swap dislocator with one in Portal
  56. end
  57.  
  58. buttonGui.label(1,1,"Current Destination:") --Show Currnt Destination
  59. ButtonGui.label(1,2,Dislocator.Name)
  60.  
  61. while true do -- Checks for Button Press
  62.     getClick()
  63.     end
  64.  
  65.  
  66.  
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement