Advertisement
Drunkmonkey

Create Power Management System | Hub

Jan 24th, 2024 (edited)
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. -- Variables --
  2. local VESRION = 0.1
  3. local PCID = os.getComputerID()
  4. local recievePC
  5.  
  6. local stressOmeter = true--periperal.find("Stressometer")
  7.  
  8. local modem = periperal.find("modem")
  9. local stressError = "Stress to High Clutch Engaged"
  10.  
  11. local foundPeriperal = false
  12. local correctInput = false
  13. local clutchOut = false
  14.  
  15. -- Checks that peripherals are installed correctly --
  16. while(foundPeriperal == fasle) do
  17. if stressOmeter and modem then
  18. print("Periphals Found...")
  19. sleep(2.5)
  20. Clear()
  21. elseif stressOmeter == false and modem == true then
  22. print("StressOmeter Not Found...")
  23. sleep(2.5)
  24. Clear()
  25. elseif stressOmeter == true and modem == false then
  26. print("Modem Not Found...")
  27. sleep(2.5)
  28. Clear()
  29. elseif stressOmeter == false and modem == false then
  30. print("No Periperal's Found...")
  31. sleep(2.5)
  32. Clear()
  33. end
  34. end
  35.  
  36. -- Disclaimer/Program Version
  37. print("Create Power Management System | HUB V".. VERSION .." Create by V01D")
  38. print("This program is the 'Heart' of the system and is designed to be hidden and")
  39. print("used in tandem with the 'Create Power Management System | Display' program.")
  40. print("This secondary program can be found here: ")
  41. print("This message will disappear in 30 seconds")
  42. sleep(30)
  43. Clear()
  44.  
  45. -- Ask's user for redstone input --
  46. print("What side is the redstone input on?")
  47. print("Options: front, back, left, right, top, bottom")
  48. redstoneSide = read();
  49. while(correctInput == false) do
  50. if redstoneSide ~= "front" or redstoneSide ~= "back" or redstoneSide ~= "left" or redstoneSide ~= "right" or redstoneSide ~= "top" or redstoneSide ~= "bottom" then
  51. Clear()
  52. print("Incorrect Value Entered. Please Try Again.")
  53. print("What side is the redstone input on?")
  54. print("Options: front, back, left, right, top, bottom")
  55. redstoneSide = read()
  56. else
  57. correctInput = true
  58. Clear()
  59. end
  60. end
  61.  
  62. -- use clutch to keep power going --
  63.  
  64. -- Sends system data over rednet--
  65. print("Rednet ID: ".. PCID)
  66. print("what is the 'Display' PC Rednet ID?")
  67. recievePC = tonumber(read())
  68. Clear()
  69.  
  70. rednet.open(modem)
  71. while true do
  72. currentStreess = stressOmeter.getStress()
  73. maxStress = stressOmeter.getStressCapacity()
  74. print(currentStreess)
  75. print(maxStress)
  76. Clear()
  77.  
  78. if (currentStreess > maxStress) then
  79. clutchOut = true
  80. redstone.setOutput(redstoneSide, true)
  81. else
  82. clutchOut = false
  83. end
  84.  
  85. if (clutchOut == false) then
  86. rednet.send(recievePC, currentStreess)
  87. rednet.send(recievePC, maxStress)
  88. else
  89. rednet.send(recievePC, stressError)
  90. end
  91. end
  92. -- Variables --
  93. local VESRION = 0.1
  94. local PCID = os.getComputerID()
  95. local recievePC
  96.  
  97. local stressOmeter = true--periperal.find("Stressometer")
  98.  
  99. local modem = periperal.find("modem")
  100. local stressError = "Stress to High Clutch Engaged"
  101.  
  102. local foundPeriperal = false
  103. local correctInput = false
  104. local clutchOut = false
  105.  
  106. -- Checks that peripherals are installed correctly --
  107. while(foundPeriperal == fasle) do
  108. if stressOmeter and modem then
  109. print("Periphals Found...")
  110. sleep(2.5)
  111. Clear()
  112. elseif stressOmeter == false and modem == true then
  113. print("StressOmeter Not Found...")
  114. sleep(2.5)
  115. Clear()
  116. elseif stressOmeter == true and modem == false then
  117. print("Modem Not Found...")
  118. sleep(2.5)
  119. Clear()
  120. elseif stressOmeter == false and modem == false then
  121. print("No Periperal's Found...")
  122. sleep(2.5)
  123. Clear()
  124. end
  125. end
  126.  
  127. -- Disclaimer/Program Version
  128. print("Create Power Management System | HUB V".. VERSION .." Create by V01D")
  129. print("This program is the 'Heart' of the system and is designed to be hidden and")
  130. print("used in tandem with the 'Create Power Management System | Display' program.")
  131. print("This secondary program can be found here: ")
  132. print("This message will disappear in 30 seconds")
  133. sleep(30)
  134. Clear()
  135.  
  136. -- Ask's user for redstone input --
  137. print("What side is the redstone input on?")
  138. print("Options: front, back, left, right, top, bottom")
  139. redstoneSide = read();
  140. while(correctInput == false) do
  141. if redstoneSide ~= "front" or redstoneSide ~= "back" or redstoneSide ~= "left" or redstoneSide ~= "right" or redstoneSide ~= "top" or redstoneSide ~= "bottom" then
  142. Clear()
  143. print("Incorrect Value Entered. Please Try Again.")
  144. print("What side is the redstone input on?")
  145. print("Options: front, back, left, right, top, bottom")
  146. redstoneSide = read()
  147. else
  148. correctInput = true
  149. Clear()
  150. end
  151. end
  152.  
  153. -- use clutch to keep power going --
  154.  
  155. -- Sends system data over rednet--
  156. print("Rednet ID: ".. PCID)
  157. print("what is the 'Display' PC Rednet ID?")
  158. recievePC = tonumber(read())
  159. Clear()
  160.  
  161. rednet.open(modem)
  162. while true do
  163. currentStreess = stressOmeter.getStress()
  164. maxStress = stressOmeter.getStressCapacity()
  165. print(currentStreess)
  166. print(maxStress)
  167. Clear()
  168.  
  169. if (currentStreess > maxStress) then
  170. clutchOut = true
  171. redstone.setOutput(redstoneSide, true)
  172. else
  173. clutchOut = false
  174. end
  175.  
  176. if (clutchOut == false) then
  177. rednet.send(recievePC, currentStreess)
  178. rednet.send(recievePC, maxStress)
  179. else
  180. rednet.send(recievePC, stressError)
  181. end
  182. end
  183.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement