Flaghacker

enderSender

May 13th, 2014
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. --[[Settings]]--
  2. local redstoneSetting = "left"
  3. local chestSetting = "right"
  4.  
  5. --[[Variables]]--
  6. local tArgs = {...}
  7. local redstoneInputSide = tArgs[1] or redstoneSetting
  8. local chestSide = tArgs[2] or chestSetting
  9. local chest = peripheral.wrap(chestSide)
  10.  
  11.  
  12. --[[Functions]]--
  13. function printBoolean(boolean)
  14.         if term.isColor() then
  15.                 if boolean then
  16.                         term.setTextColor(colors.lime)
  17.                 else
  18.                         term.setTextColor(colors.red)
  19.                 end
  20.         end
  21.         print(boolean)
  22.         if term.isColor() then
  23.                 term.setTextColor(colors.white)
  24.         end
  25. end
  26.  
  27. function setChest(boolean)
  28.     if chest.getStackInSlot(1) and not boolean or chest.getStackInSlot(2) and boolean then
  29.         chest.swapStacks(1,2)
  30.     end
  31. end
  32.  
  33. --[[Main program]]--
  34. while true do
  35.     setChest(rs.getInput(redstoneInputSide))
  36.     shell.run("clear")
  37.     print("EnderSender")
  38.     printBoolean(rs.getInput(redstoneInputSide))
  39.     os.pullEvent("redstone")
  40. end
Advertisement
Add Comment
Please, Sign In to add comment