Guest User

rset.lua

a guest
Jun 5th, 2020
45
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2. local sides = require("sides")
  3. local colors = require("colors")
  4. local rs = component.proxy("cfbe0990-8d07-4f27-8a2f-73c641006fab")
  5. args = {...}
  6. -- print(x)
  7. if args[1] == "all" then
  8.   if args[2] == "on" then
  9.     for i = 1, 16, 1 do
  10.       rs.setBundledOutput(sides.north, i - 1, 255)
  11.       rs.setBundledOutput(sides.south, i - 1, 255)
  12.     end
  13.   elseif args[2] == "off" then
  14.     for i = 1, 16, 1 do
  15.       rs.setBundledOutput(sides.north, i - 1, 0)
  16.       rs.setBundledOutput(sides.south, i - 1, 0)
  17.     end
  18.   else
  19.     print("ERROR: Arg 2 must be ON or OFF")
  20.   end
  21. else
  22.   x = #args[1]
  23.   -- print(x)
  24.   if x < 33 then
  25.   for i = 1, x, 1 do
  26.     if args[1]:sub(i,i) == "1" then
  27.       if i > 16 then
  28.         a = i - 17
  29.         rs.setBundledOutput(sides.north, a, 255)
  30.         print("2-set")
  31.       else
  32.         rs.setBundledOutput(sides.south, i - 1, 255)
  33.         print("1-set")
  34.       end
  35.     elseif args[1]:sub(i,i) == "0" then
  36.       if i > 16 then
  37.         a = i - 17
  38.         rs.setBundledOutput(sides.north, a, 0)
  39.         print("2-unset")
  40.       else
  41.         rs.setBundledOutput(sides.south, i - 1, 0)    
  42.         print("1-unset")
  43.       end
  44.     end
  45.   end
  46.   end
  47. end
RAW Paste Data