SHARE
TWEET

startup

a guest May 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2. sen = sensor.wrap("top")
  3. while true do
  4.   tank = sen.getTargetDetails("1,-1,1")
  5.   bas = sen.getTargetDetails("0,-2,1")
  6.   pipe = sen.getTargetDetails("0, -1, 1")
  7.  
  8.  
  9.   --print(textutils.serialize(pipe))
  10.   --print(textutils.serialize(tank))
  11.  
  12.  
  13.   rs.setOutput("left", false)
  14.   rs.setOutput("front", false)
  15.   rs.setOutput("left", false)
  16.  
  17.   aTank = tank["Tanks"][1]["Amount"]
  18.   aBas = bas["Tanks"][1]["Amount"]
  19.  
  20.   nTank = tank["Tanks"][1]["RawName"]
  21.   nBas = bas["Tanks"][1]["RawName"]
  22.  
  23.   if aTank >= 1296 and ((aBas > 0 and nBas == nTank) or aBas == 0) then
  24.     repeat
  25.       aBas = sen.getTargetDetails("0,-2,1")["Tanks"][1]["Amount"]
  26.       aTank = sen.getTargetDetails("1,-1,1")["Tanks"][1]["Amount"]
  27.       rs.setOutput("right", true)
  28.       sleep(0.5)
  29.       rs.setOutput("right", false)
  30.       print(aTank)
  31.     until aTank < 1296
  32.   end
  33.  
  34.   if ((nBas ~= nil and nTank ~= nil) and nBas ~= nTank) or aBas >0 and aBas<1296 then
  35.     repeat    
  36.       aBas = sen.getTargetDetails("0,-2,1")["Tanks"][1]["Amount"]
  37.       rs.setOutput("left", true)
  38.       sleep(0.5)
  39.       print(aBas)
  40.       rs.setOutput("left", false)
  41.     until aBas == 0
  42.   end
  43.  
  44.   if aTank < 1296 and aTank >= 144 then
  45.     rs.setOutput("front", true)
  46.     sleep(0.5)
  47.     print("c")
  48.     rs.setOutput("front", false)
  49.   end
  50. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top