Advertisement
Bollie

Extractor nislim

May 2nd, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. E = peripheral.wrap("Extractor_2")
  2. G = peripheral.wrap("AdvancedGears_1")
  3.  
  4. function speed(slot, a)
  5.     G.setRatio(32)
  6.     print("Slot "..slot.."="..a.." => Speed")
  7. end
  8.  
  9. function torque(slot, a)
  10.     G.setRatio(1)
  11.     print("Slot "..slot.."="..a.." => Torque")
  12. end
  13.  
  14. while true do
  15.     p, t, s = G.getPower()
  16.    
  17.     A, B, C = E.getSlot(3)
  18.     if (C or 0) > 0 then
  19.         torque(3, C)
  20.     else
  21.         A, B, C = E.getSlot(2)
  22.         if (C or 0) > 0 then
  23.             speed(2, C)
  24.         else
  25.             A, B, C = E.getSlot(1)
  26.             if (C or 0) > 0 then
  27.                 speed(1, C)
  28.             else
  29.                 A, B, C = E.getSlot(0)
  30.                 if (C or 0) > 0 then
  31.                     torque(0, C)
  32.                 end
  33.             end
  34.         end
  35.     end
  36.    
  37.     os.sleep(15)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement