Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. ^Seamark:\s+(.+)$
  2. ^Capacity:\s+(\d+).+$
  3.  
  4. local spaces = (string.len(multimatches[2][1]) + 2)
  5. if not harbours[multimatches[1][2]] then
  6.     harbours[multimatches[1][2]] = {}
  7.     harbours[multimatches[1][2]].count = tonumber(multimatches[2][2])
  8.     harbours[multimatches[1][2]].time = getTime(true, "HH:mm:ss")
  9. else
  10.     if harbours[multimatches[1][2]].count ~= tonumber(multimatches[2][2]) then
  11.         local change = (harbours[multimatches[1][2]].count - tonumber(multimatches[2][2]))
  12.         local newTime = getTime(true, "HH:mm:ss")
  13.         if change > 0 then
  14.             cecho("<gray>  (<green>-"..math.abs(change).."<gray>)<orange> DOWN!<cyan>\n"..string.rep(" ", spaces).."Last time: <white>"..harbours[multimatches[1][2]].time.."<cyan>\n"..string.rep(" ", spaces).."Current time: <white>"..newTime)
  15.         else
  16.             cecho("<gray>  (<red>+"..math.abs(change).."<gray>)<magenta> up<cyan>\n"..string.rep(" ", spaces).."Last time: <white>"..harbours[multimatches[1][2]].time.."<cyan>\n"..string.rep(" ", spaces).."Current time: <white>"..newTime)
  17.         end
  18.         --update count/time after changes calculated       
  19.         harbours[multimatches[1][2]].time = newTime
  20.         harbours[multimatches[1][2]].count = tonumber(multimatches[2][2])
  21.     else
  22.         cecho("<magenta>  No change<cyan>\n"..string.rep(" ", spaces).."Last time: <white>"..harbours[multimatches[1][2]].time.."\n<cyan>"..string.rep(" ", spaces).."Current time: <white>"..getTime(true, "HH:mm:ss"))
  23.         --update time after changes displayed
  24.         harbours[multimatches[1][2]].time = getTime(true, "HH:mm:ss")
  25.     end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement