SteamPunk_Devil

TankMon ReWrite

Mar 8th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. --SteamPunk_Devil's Tank Monitor!
  2. print("SteamPunk_Devil's Tank Monitor V1.0")
  3. os.unloadAPI("API/steAmPI")
  4. os.loadAPI("API/steAmPI")
  5.  
  6. while true do
  7.     local PeriList = peripheral.getNames()
  8.     local TankList = {}
  9.     local OtherPeriList = {}
  10.     local MonList = {}
  11.     local Pos = 1
  12.    
  13.     for i = 1, #PeriList do
  14.         if string.match(PeriList[i],"tankvalvetile") then
  15.             TankList[#TankList + 1] = PeriList[i]
  16.         elseif string.match(PeriList[i],"monitor") then
  17.             MonList[#MonList + 1] = PeriList[i]
  18.         else
  19.             OtherPeriList[#OtherPeriList + 1] = PeriList[i]
  20.         end
  21.     end
  22.     local Mon = peripheral.wrap(MonList[1])
  23.     if #TankList <= 8 then
  24.     for T = 1, #TankList do
  25.             steAmPI.FluPrinter(TankList[T], Mon, Pos)
  26.             Pos = Pos + 1
  27.     end
  28.     else
  29.     print("This Program can only use up to 8 tanks")
  30.     end
  31. local MonTouch = {os.pullEvent()}
  32.     if MonTouch[1] == "monitor_touch" then
  33.             if MonTouch[3] >= 2 and MonTouch[3] <= 12 and MonTouch[4] >= 2 and MonTouch[4] <= 3 then
  34.                 steAmPI.OnPushData(TankList[1], Mon)
  35.             elseif MonTouch[3] >= 18 and MonTouch[3] <= 28 and MonTouch[4] >= 2 and MonTouch[4] <= 3 then
  36.                 steAmPI.OnPushData(TankList[2], Mon)
  37.             elseif MonTouch[3] >= 2 and MonTouch[3] <= 12 and MonTouch[4] >= 5 and MonTouch[4] <= 6 then
  38.                 steAmPI.OnPushData(TankList[3], Mon)
  39.             elseif MonTouch[3] >= 18 and MonTouch[3] <= 28 and MonTouch[4] >= 5 and MonTouch[4] <= 6 then
  40.                 steAmPI.OnPushData(TankList[4], Mon)   
  41.             elseif MonTouch[3] >= 2 and MonTouch[3] <= 12 and MonTouch[4] >= 8 and MonTouch[4] <= 9 then
  42.                 steAmPI.OnPushData(TankList[5], Mon)
  43.             elseif MonTouch[3] >= 18 and MonTouch[3] <= 28 and MonTouch[4] >= 8 and MonTouch[4] <= 9 then
  44.                 steAmPI.OnPushData(TankList[6], Mon)
  45.             elseif MonTouch[3] >= 2 and MonTouch[3] <= 12 and MonTouch[4] >= 11 and MonTouch[4] <= 12 then
  46.                 steAmPI.OnPushData(TankList[7], Mon)
  47.             elseif MonTouch[3] >= 18 and MonTouch[3] <= 28 and MonTouch[4] >= 11 and MonTouch[4] <= 12 then
  48.                 steAmPI.OnPushData(TankList[8], Mon)   
  49.             else
  50.             end
  51.             else
  52.     end
  53.             --skip
  54.   end
Advertisement
Add Comment
Please, Sign In to add comment