Advertisement
infiniteblock

WWCS Server

Apr 3rd, 2020
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --#load the touchpoint API
  2. os.loadAPI("touchpoint")
  3. os.sleep(1)
  4.  
  5. --# wrap the modem to the computer
  6. local wlan = peripheral.wrap("bottom")
  7.  
  8. --# initialize the button instance set on the monitor
  9. local t = touchpoint.new("right")
  10.  
  11. --# Add a new button
  12. t:add("WWCS - Click To Enable/Disable", nil, 5, 1, 45, 1, colors.gray, colors.gray)
  13. t:add("Shulker", nil, 5, 3, 17, 3, colors.red, colors.green)
  14. t:add("Wither", nil, 19, 3, 31, 3, colors.red, colors.green)
  15. t:add("FeralGhoul", nil, 33, 3, 45, 3, colors.red, colors.green)
  16. t:add("Evoker", nil, 5, 5, 17, 5, colors.red, colors.green)  
  17. t:add("ZPigman", nil, 19, 5, 31, 5, colors.red, colors.green)
  18. t:add("Ghast", nil, 33, 5, 45, 5, colors.red, colors.green)
  19. t:add("Skeleton", nil, 5, 7, 17, 7, colors.red, colors.green)  
  20. t:add("ZMiner", nil, 19, 7, 31, 7, colors.red, colors.green)
  21. t:add("Witch", nil, 33, 7, 45, 7, colors.red, colors.green)
  22. t:add("Blizz", nil, 5, 9, 17, 9, colors.red, colors.green)  
  23. t:add("Slime", nil, 19, 9, 31, 9, colors.red, colors.green)
  24. t:add("Cyberdemon", nil, 33, 9, 45, 9, colors.red, colors.green)
  25. t:add("Spider", nil, 5, 11, 17, 11, colors.red, colors.green)  
  26. t:add("Enderman", nil, 19, 11, 31, 11, colors.red, colors.green)
  27.  
  28. --# draw the buttons
  29. t:draw()
  30.  
  31. while true do
  32.   --# handleEvents will convert monitor_touch events to button_click if it was on a button
  33.   local event, p1 = t:handleEvents(os.pullEvent())
  34.   if event == "button_click" then
  35.         if p1 == "Shulker" then
  36.         t:toggleButton(p1)
  37.         if t.buttonList.Shulker.active then
  38.                wlan.transmit(1,10,"WWCSON")
  39.             else
  40.                wlan.transmit(1,10,"WWCSOFF")
  41.        end
  42.         elseif p1 == "Wither" then
  43.         t:toggleButton(p1)
  44.         if t.buttonList.Wither.active then
  45.                wlan.transmit(2,10,"WWCSON")
  46.             else
  47.                wlan.transmit(2,10,"WWCSOFF")
  48.        end
  49.         elseif p1 == "FeralGhoul" then
  50.         t:toggleButton(p1)
  51.         if t.buttonList.FeralGhoul.active then
  52.                wlan.transmit(3,10,"WWCSON")
  53.             else
  54.                wlan.transmit(3,10,"WWCSOFF")
  55.        end
  56.         elseif p1 == "Evoker" then
  57.         t:toggleButton(p1)
  58.         if t.buttonList.Evoker.active then
  59.                wlan.transmit(4,10,"WWCSON")
  60.             else
  61.                wlan.transmit(4,10,"WWCSOFF")
  62.        end
  63.         elseif p1 == "ZPigman" then
  64.         t:toggleButton(p1)
  65.         if t.buttonList.ZPigman.active then
  66.                wlan.transmit(5,10,"WWCSON")
  67.             else
  68.                wlan.transmit(5,10,"WWCSOFF")
  69.        end
  70.         elseif p1 == "Ghast" then
  71.         t:toggleButton(p1)
  72.         if t.buttonList.Ghast.active then
  73.                wlan.transmit(6,10,"WWCSON")
  74.             else
  75.                wlan.transmit(6,10,"WWCSOFF")
  76.        end
  77.         elseif p1 == "Skeleton" then
  78.         t:toggleButton(p1)
  79.         if t.buttonList.Skeleton.active then
  80.                wlan.transmit(7,10,"WWCSON")
  81.             else
  82.                wlan.transmit(7,10,"WWCSOFF")
  83.        end
  84.         elseif p1 == "ZMiner" then
  85.         t:toggleButton(p1)
  86.         if t.buttonList.ZMiner.active then
  87.                wlan.transmit(8,10,"WWCSON")
  88.             else
  89.                wlan.transmit(8,10,"WWCSOFF")
  90.        end
  91.         elseif p1 == "Witch" then
  92.         t:toggleButton(p1)
  93.         if t.buttonList.Witch.active then
  94.                wlan.transmit(9,10,"WWCSON")
  95.             else
  96.                wlan.transmit(9,10,"WWCSOFF")
  97.        end
  98.         elseif p1 == "Blizz" then
  99.         t:toggleButton(p1)
  100.         if t.buttonList.Blizz.active then
  101.                wlan.transmit(10,10,"WWCSON")
  102.             else
  103.                wlan.transmit(10,10,"WWCSOFF")
  104.        end
  105.         elseif p1 == "Slime" then
  106.         t:toggleButton(p1)
  107.         if t.buttonList.Slime.active then
  108.                wlan.transmit(11,10,"WWCSON")
  109.             else
  110.                wlan.transmit(11,10,"WWCSOFF")
  111.        end
  112.         elseif p1 == "Cyberdemon" then
  113.         t:toggleButton(p1)
  114.         if t.buttonList.Cyberdemon.active then
  115.                wlan.transmit(12,10,"WWCSON")
  116.             else
  117.                wlan.transmit(12,10,"WWCSOFF")
  118.        end
  119.         elseif p1 == "Spider" then
  120.         t:toggleButton(p1)
  121.         if t.buttonList.Spider.active then
  122.                wlan.transmit(13,10,"WWCSON")
  123.             else
  124.                wlan.transmit(13,10,"WWCSOFF")
  125.        end
  126.         elseif p1 == "Enderman" then
  127.         t:toggleButton(p1)
  128.         if t.buttonList.Enderman.active then
  129.                wlan.transmit(14,10,"WWCSON")
  130.             else
  131.                wlan.transmit(14,10,"WWCSOFF")
  132.        end
  133.      end
  134.   end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement