Advertisement
Guest User

spawner

a guest
Apr 8th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.31 KB | None | 0 0
  1. --2551 this pc
  2. print("running spawner")
  3. local Tid = 2618
  4. local mon = peripheral.wrap("monitor_19")
  5.  
  6. rednet.open("top")
  7. function ui()
  8. mon.setCursorPos(1,1)
  9. mon.write("-------------------------------------------------------------")
  10. mon.setCursorPos(1,2)
  11. mon.write("I                          spawner                          I")
  12. for i = 3 ,18 do
  13. mon.setCursorPos(1,i)
  14. mon.write("I                                                           I")
  15. end
  16. mon.setCursorPos(1,19)
  17. mon.write("-------------------------------------------------------------")
  18.  
  19.  
  20. end
  21. function tr(clr)
  22. mon.setTextColor(colors.red)
  23. end
  24. function tw()
  25. mon.setTextColor(colors.white)
  26. end
  27. function tg()
  28. mon.setTextColor(colors.green)
  29. end
  30.  
  31. function ol() -- load screen ui on start
  32. tr()
  33. mon.setCursorPos(5,7)
  34. mon.write("Penguin")
  35. mon.setCursorPos(16,7)
  36. mon.write("Enderman")
  37. mon.setCursorPos(28,7)
  38. mon.write("Blaze")
  39.  
  40. tw()
  41. end
  42.  
  43. local pen = 0
  44. local ender = 0
  45. local blaze = 0
  46. local MOB = "empty"
  47.  
  48. function press() --when pressed
  49. event, side, x, y = os.pullEvent("monitor_touch")
  50.  
  51. if x > 4 and x < 12 and y == 7 then --penguins
  52.     if pen == 0 and MOB == "empty" then
  53.         tg()
  54.         pen = 1
  55.         --do stuff
  56.         MOB = "penguin"
  57.     elseif pen == 1 and MOB == "penguin"then
  58.         tr()
  59.         pen = 0
  60.         --do stuff
  61.         MOB = "empty"
  62.     end
  63.         mon.setCursorPos(5,7)
  64.         mon.write("Penguin")
  65.         tw()
  66.         rednet.send(Tid,MOB)
  67.        
  68. elseif x > 15 and x < 24 and y == 7 then -- enderman
  69.     if ender == 0 and MOB == "empty" then
  70.         tg()
  71.         ender = 1
  72.         MOB = "enderman"
  73.     elseif ender == 1 and MOB == "enderman" then
  74.         tr()
  75.         ender = 0
  76.         MOB = "empty"
  77.     end
  78.         mon.setCursorPos(16,7)
  79.         mon.write("Enderman")
  80.         tw()
  81.         rednet.send(Tid,MOB)
  82. elseif x > 27 and x < 33 and y == 7 then --blaze
  83.     if blaze == 0 and MOB == "empty" then
  84.         tg()
  85.         blaze = 1
  86.         MOB = "blaze"
  87.     elseif blaze == 1 and MOB == "blaze" then
  88.         tr()
  89.         blaze = 0
  90.         MOB = "empty"
  91.     end
  92.         mon.setCursorPos(28,7)
  93.         mon.write("Blaze")
  94.         tw()
  95.         rednet.send(Tid,MOB)
  96. else
  97.  
  98. end
  99. --print(Tid .. MOB..ender)
  100. end
  101.  
  102. mon.clear()
  103. mon.setCursorPos(1,1)
  104. ui()
  105. ol()
  106. while true do
  107. press()
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement