Advertisement
Guest User

install

a guest
Oct 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.65 KB | None | 0 0
  1. term.setTextColor(colors.blue)
  2. print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  3. term.setTextColor(colors.white)
  4. print("select time to wait between end of one order till next order. It have to bee higher than the ritual takes (seconds, default 300)")
  5. sdelay = read()
  6. if tonumber(sdelay) == "" then
  7. delay = 6000
  8. else
  9. if tonumber(sdelay) == nil then
  10. delay = 6000
  11. else
  12. delay = tonumber(sdelay) * 20
  13. end
  14. end
  15. term.clear()
  16. term.setCursorPos(1,1)
  17. term.setTextColor(colors.blue)
  18. print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  19. term.setTextColor(colors.white)
  20. print("select the side where the redstone signal of the level emitter is attached (right,left,back,front,bottom,top)")
  21. err = true
  22. while err do
  23.     side = read()
  24.     if (side == "right") or (side == "left") or (side == "back") or (side == "front") or (side == "top") or (side == "bottom") then
  25.         err = false
  26.     else
  27.         term.clear()
  28.         term.setCursorPos(1,1)
  29.         term.setTextColor(colors.blue)
  30.         print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  31.         term.setTextColor(colors.red)
  32.         print("Please choose one of the following: (right,left,back,front,bottom,top)")
  33.         term.setTextColor(colors.white)
  34.     end
  35. end
  36. term.clear()
  37. term.setCursorPos(1,1)
  38. term.setTextColor(colors.blue)
  39. print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  40. term.setTextColor(colors.white)
  41. les = side
  42. print("select the side where the redstone signal of the heart detector is attached (right,left,back,front,bottom,top)")
  43. err = true
  44. while err do
  45.     side = read()
  46.     if (side == "right") or (side == "left") or (side == "back") or (side == "front") or (side == "top") or (side == "bottom") then
  47.         err = false
  48.     else
  49.         term.clear()
  50.         term.setCursorPos(1,1)
  51.         term.setTextColor(colors.blue)
  52.         print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  53.         term.setTextColor(colors.red)
  54.         print("Please choose one of the following: (right,left,back,front,bottom,top)")
  55.         term.setTextColor(colors.white)
  56.     end
  57. end
  58. term.clear()
  59. term.setCursorPos(1,1)
  60. term.setTextColor(colors.blue)
  61. print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  62. term.setTextColor(colors.white)
  63. hds = side
  64. print("select the side where the autonomous activator is attached (right,left,back,front,bottom,top)")
  65. err = true
  66. while err do
  67.     side = read()
  68.     if (side == "right") or (side == "left") or (side == "back") or (side == "front") or (side == "top") or (side == "bottom") then
  69.         err = false
  70.     else
  71.         term.clear()
  72.         term.setCursorPos(1,1)
  73.         term.setTextColor(colors.blue)
  74.         print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  75.         term.setTextColor(colors.red)
  76.         print("Please choose one of the following: (right,left,back,front,bottom,top)")
  77.         term.setTextColor(colors.white)
  78.     end
  79. end
  80. aas = side
  81. term.clear()
  82. term.setCursorPos(1,1)
  83. term.setTextColor(colors.blue)
  84. print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  85. term.setTextColor(colors.white)
  86. print("installing....")
  87.  
  88. mf = fs.open("end", "w")
  89.  
  90. mf.writeLine("delay = " .. delay)
  91. mf.writeLine("activatordel = 0.8")
  92.  
  93. mf.writeLine("levelemitter = \"" .. les .. "\"")
  94. mf.writeLine("heartdetector = \"" .. hds .. "\"")
  95. mf.writeLine("activator = \"" .. aas .."\"")
  96.  
  97. mf.writeLine("dsfr = fs.open(\"dsf\", \"r\")")
  98. mf.writeLine("dtext = dsfr.readLine()")
  99. mf.writeLine("dsf = fs.open(\"dsf\", \"w\")")
  100. mf.writeLine("dsf.writeLine(dtext)")
  101. mf.writeLine("dsf.flush()")
  102.  
  103. mf.writeLine("cdelay = tonumber(dtext)")
  104.  
  105. mf.writeLine("rsfr = fs.open(\"rsf\", \"r\")")
  106. mf.writeLine("rtext = rsfr.readLine()")
  107. mf.writeLine("rsf = fs.open(\"rsf\", \"w\")")
  108. mf.writeLine("rsf.writeLine(rtext)")
  109. mf.writeLine("rsf.flush()")
  110. mf.writeLine("if rtext == \"true\" then")
  111. mf.writeLine("  rq = true")
  112. mf.writeLine("else")
  113. mf.writeLine("  rq = false")
  114. mf.writeLine("end")
  115. mf.writeLine("le = false")
  116. mf.writeLine("print(\"Starting end script ...\")")
  117. mf.writeLine("print(\"Sucessfully started end script!\")")
  118. mf.writeLine("while true do   ")
  119. mf.writeLine("  if cdelay > 0 then")
  120. mf.writeLine("    cdelay = cdelay - 1")
  121. mf.writeLine("    dsf = fs.open(\"dsf\",\"w\")")
  122. mf.writeLine("    dsf.write(cdelay)")
  123. mf.writeLine("    dsf.flush()")
  124. mf.writeLine("  end")
  125. mf.writeLine("  if redstone.getInput(heartdetector) == true then")
  126. mf.writeLine("    if le == true then")
  127. mf.writeLine("      redstone.setOutput(activator , true)")
  128. mf.writeLine("      sleep(activatordel)")
  129. mf.writeLine("      redstone.setOutput(activator , false)")
  130. mf.writeLine("      cdelay = 6000")
  131. mf.writeLine("      dsf = fs.open(\"dsf\", \"w\")")
  132. mf.writeLine("      dsf.write(\"6000\")")
  133. mf.writeLine("      dsf.flush()")
  134. mf.writeLine("    else")
  135. mf.writeLine("      rq = true")
  136. mf.writeLine("      rsf = fs.open(\"rsf\",\"w\")")
  137. mf.writeLine("      rsf.write(\"true\")")
  138. mf.writeLine("      rsf.flush()")
  139. mf.writeLine("    end")
  140. mf.writeLine("  end")
  141. mf.writeLine("  if redstone.getInput(levelemitter) == true then")
  142. mf.writeLine("    le = true")
  143. mf.writeLine("    if rq then")
  144. mf.writeLine("      redstone.setOutput(activator , true)")
  145. mf.writeLine("      sleep(activatordel)")
  146. mf.writeLine("      redstone.setOutput(activator , false)")
  147. mf.writeLine("      rq = false")
  148. mf.writeLine("      rsf = fs.open(\"rsf\" , \"w\")")
  149. mf.writeLine("      rsf.write(\"false\")")
  150. mf.writeLine("      rsf.flush()")
  151. mf.writeLine("      cdelay = 6000")
  152. mf.writeLine("      dsf = fs.open(\"dsf\",\"w\")")
  153. mf.writeLine("      dsf.write(\"6000\")")
  154. mf.writeLine("      dsf.flush()")
  155. mf.writeLine("    end")
  156. mf.writeLine("    if cdelay == 0 then")
  157. mf.writeLine("      redstone.setOutput(activator , true)")
  158. mf.writeLine("      sleep(activatordel)")
  159. mf.writeLine("      redstone.setOutput(activator , false)")
  160. mf.writeLine("      cdelay = 6000")
  161. mf.writeLine("      dsf = fs.open(\"dsf\",\"w\")")
  162. mf.writeLine("      dsf.write(\"6000\")")
  163. mf.writeLine("      dsf.flush()")
  164. mf.writeLine("    end")
  165. mf.writeLine("  else")
  166. mf.writeLine("    le = false    ")
  167. mf.writeLine("  end")
  168. mf.writeLine("  sleep(0.5)")
  169. mf.writeLine("end")
  170. mf.close()
  171.  
  172. dsf = fs.open("dsf", "w")
  173. dsf.writeLine("0")
  174. dsf.close()
  175.  
  176. rsf = fs.open("rsf", "w")
  177. rsf.writeLine("false")
  178. rsf.close()
  179.  
  180. stup = fs.open("startup","a")
  181. stup.writeLine("shell.run(\"end\")")
  182. stup.close()
  183.  
  184. term.clear()
  185. term.setCursorPos(1,1)
  186. term.setTextColor(colors.blue)
  187. print("INSTALL SCRIPT FOR AUTOMATIC END FARM 1.7.10")
  188. term.setTextColor(colors.green)
  189. print("finished")
  190. term.setTextColor(colors.white)
  191.  
  192. shell.run("label set END_TURTLE_FOR_RGBPIXL_FROM_REAKTORINGHD")
  193. print("press any key to reboot and finish the installation")
  194. read()
  195. shell.run("reboot")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement