Guest User

startup

a guest
Jan 27th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.33 KB | None | 0 0
  1. rednet.open("top")
  2. local side = "back"
  3. local int = 0
  4. local name = "null"
  5. local state = "false"
  6.  
  7. active =
  8. {
  9.     ["test"] = false,
  10.     ["cow"] = false,
  11.     ["wither"] = false,
  12.     ["sheep"] = false,
  13.     ["squid"] = false,
  14.     ["ghast"] = false,
  15.     ["blaze"] = false,
  16.     ["creeper"] = false,
  17.     ["witch"] = false,
  18.     ["pigman"] = false,
  19.     ["enderman"] = false,
  20.     ["golem"] = false,
  21.     ["blizz"] = false
  22. }
  23.  
  24. redstone.setBundledOutput(side, 0)
  25.  
  26. function update()
  27.     if int >= 0 then
  28.         redstone.setBundledOutput(side, int)
  29.     else
  30.         int = 0
  31.         print("ERROR://INT=MINUS")
  32.     end
  33. end
  34.  
  35. while true do
  36.     id, cmd = rednet.receive()
  37.    
  38.     -- Sheep, white
  39.     if cmd == "sheep on" then
  40.         if active["sheep"] == false then
  41.             int = int + 1
  42.             active["sheep"] = true
  43.             update()
  44.         end
  45.     elseif cmd == "sheep off" then
  46.         if active["sheep"] == true then
  47.             int = int - 1
  48.             active["sheep"] = false
  49.             update()
  50.         end
  51.     -- Wither skeletons, black
  52.     elseif cmd == "wither on" then
  53.         if active["wither"] == false then
  54.             int = int + 32768
  55.             active["wither"] = true
  56.             update()
  57.         end
  58.     elseif cmd == "wither off" then
  59.         if active["wither"] == true then
  60.             int = int - 32768
  61.             active["wither"] = false
  62.             update()
  63.         end
  64.     -- Squid, blue
  65.     elseif cmd == "squid on" then
  66.         if active["squid"] == false then
  67.             int = int + 2048
  68.             active["squid"] = true
  69.             update()
  70.         end
  71.     elseif cmd == "squid off" then
  72.         if active["squid"] == true then
  73.             int = int - 2048
  74.             active["squid"] = false
  75.             update()
  76.         end
  77.     -- Cow, brown
  78.     elseif cmd == "cow on" then
  79.         if active["cow"] == false then
  80.             int = int + 4096
  81.             active["cow"] = true
  82.             update()
  83.         end
  84.     elseif cmd == "cow off" then
  85.         if active["cow"] == true then
  86.             int = int - 4096
  87.             active["cow"] = false
  88.             update()
  89.         end
  90.     -- TEST, yellow
  91.     elseif cmd == "test on" then
  92.         if active["test"] == false then
  93.             int = int + 16
  94.             active["test"] = true
  95.             update()
  96.         end
  97.     elseif cmd == "test off" then
  98.         if active["test"] == true then
  99.             int = int - 16
  100.             active["test"] = false
  101.             update()
  102.         end
  103.     -- Ghast, light gray
  104.     elseif cmd == "ghast on" then
  105.         if active["ghast"] == false then
  106.             int = int + 256
  107.             active["ghast"] = true
  108.             update()
  109.         end
  110.     elseif cmd == "ghast off" then
  111.         if active["ghast"] == true then
  112.             int = int - 256
  113.             active["ghast"] = false
  114.             update()
  115.         end
  116.     -- Blaze, red
  117.     elseif cmd == "blaze on" then
  118.         if active["blaze"] == false then
  119.             int = int + 16384
  120.             active["blaze"] = true
  121.             update()
  122.         end
  123.     elseif cmd == "blaze off" then
  124.         if active["blaze"] == true then
  125.             int = int - 16384
  126.             active["blaze"] = false
  127.             update()
  128.         end
  129.     -- Creeper, green
  130.     elseif cmd == "creeper on" then
  131.         if active["creeper"] == false then
  132.             int = int + 8192
  133.             active["creeper"] = true
  134.             update()
  135.         end
  136.     elseif cmd == "creeper off" then
  137.         if active["creeper"] == true then
  138.             int = int - 8192
  139.             active["creeper"] = false
  140.             update()
  141.         end    
  142.     -- Witch, purple
  143.     elseif cmd == "witch on" then
  144.         if active["witch"] == false then
  145.             int = int + 1024
  146.             active["witch"] = true
  147.             update()
  148.         end
  149.     elseif cmd == "witch off" then
  150.         if active["witch"] == true then
  151.             int = int - 1024
  152.             active["witch"] = false
  153.             update()
  154.         end    
  155.     -- Pigman, orange
  156.     elseif cmd == "pigman on" then
  157.         if active["pigman"] == false then
  158.             int = int + 2
  159.             active["pigman"] = true
  160.             update()
  161.         end
  162.     elseif cmd == "pigman off" then
  163.         if active["pigman"] == true then
  164.             int = int - 2
  165.             active["pigman"] = false
  166.             update()
  167.         end
  168.     -- Enderman, light blue
  169.     elseif cmd == "enderman on" then
  170.         if active["enderman"] == false then
  171.             int = int + 8
  172.             active["enderman"] = true
  173.             update()
  174.         end
  175.     elseif cmd == "enderman off" then
  176.         if active["enderman"] == true then
  177.             int = int - 8
  178.             active["enderman"] = false
  179.             update()
  180.         end
  181.     -- Golem, gray
  182.     elseif cmd == "golem on" then
  183.         if active["golem"] == false then
  184.             int = int + 128
  185.             active["golem"] = true
  186.             update()
  187.         end
  188.     elseif cmd == "golem off" then
  189.         if active["golem"] == true then
  190.             int = int - 128
  191.             active["golem"] = false
  192.             update()
  193.         end
  194.     -- Blizz, magenta
  195.     elseif cmd == "blizz on" then
  196.         if active["blizz"] == false then
  197.             int = int + 4
  198.             active["blizz"] = true
  199.             update()
  200.         end
  201.     elseif cmd == "blizz off" then
  202.         if active["blizz"] == true then
  203.             int = int - 4
  204.             active["blizz"] = false
  205.             update()
  206.         end
  207.     end
  208. end
Advertisement
Add Comment
Please, Sign In to add comment