Advertisement
Guest User

test.sys

a guest
Jul 31st, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.36 KB | None | 0 0
  1. local nameOfDraconicEnergyStorage = peripheral.find( "draconic_rf_storage" )
  2. local currentEnergyStoredRaw = nameOfDraconicEnergyStorage.getEnergyStored()
  3. local currentEnergyStored = textutils.serialise( currentEnergyStoredRaw )
  4.  
  5.  
  6.     term.setCursorPos(1,1)
  7.     term.clearLine()
  8.     if currentEnergyStored then
  9.         if string.len( currentEnergyStored ) == 1 then
  10.             --print( "Befor: "..currentEnergyStored )
  11.             local first = string.sub(currentEnergyStoredRaw,1,1)
  12.             print( "After: "..first)
  13.         end
  14.         if string.len( currentEnergyStored ) == 2 then
  15.             --print( "Befor: "..currentEnergyStored )
  16.             local first = string.sub(currentEnergyStoredRaw,1,2)
  17.             print( "After: "..first)
  18.         end
  19.         if string.len( currentEnergyStored ) == 3 then
  20.             --print( "Befor: "..currentEnergyStored )
  21.             local first = string.sub(currentEnergyStoredRaw,1,3)
  22.             print( "After: "..first)
  23.         end
  24.     end
  25.  
  26.     if currentEnergyStored then
  27.         if string.len( currentEnergyStored ) == 4 then
  28.             --print( "Befor: "..currentEnergyStored )
  29.             local first = string.sub(currentEnergyStoredRaw,1,1)
  30.             local other = string.sub(currentEnergyStoredRaw,2,4)
  31.             print( "After: "..first..","..other)
  32.         end
  33.         if string.len( currentEnergyStored ) == 5 then
  34.             --print( "Befor: "..currentEnergyStored )
  35.             local first = string.sub(currentEnergyStoredRaw,1,2)
  36.             local other = string.sub(currentEnergyStoredRaw,3,5)
  37.             print( "After: "..first..","..other)
  38.         end
  39.         if string.len( currentEnergyStored ) == 6 then
  40.             --print( "Befor: "..currentEnergyStored )
  41.             local first = string.sub(currentEnergyStoredRaw,1,3)
  42.             local other = string.sub(currentEnergyStoredRaw,4,6)
  43.             print( "After: "..first..","..other)
  44.         end
  45.     end
  46.  
  47.     if currentEnergyStored then
  48.         if string.len( currentEnergyStored ) == 7 then
  49.             --print( "Befor: "..currentEnergyStored )
  50.             local first = string.sub(currentEnergyStoredRaw,1,1)
  51.             local other1 = string.sub(currentEnergyStoredRaw,2,4)
  52.             local other2 = string.sub(currentEnergyStoredRaw,5,7)
  53.             print( "After: "..first..","..other1..","..other2)
  54.         end
  55.         if string.len( currentEnergyStored ) == 8 then
  56.             --print( "Befor: "..currentEnergyStored )
  57.             local first = string.sub(currentEnergyStoredRaw,1,2)
  58.             local other1 = string.sub(currentEnergyStoredRaw,3,5)
  59.             local other2 = string.sub(currentEnergyStoredRaw,6,8)
  60.             print( "After: "..first..","..other1..","..other2)
  61.         end
  62.         if string.len( currentEnergyStored ) == 9 then
  63.             --print( "Befor: "..currentEnergyStored )
  64.             local first = string.sub(currentEnergyStoredRaw,1,3)
  65.             local other1 = string.sub(currentEnergyStoredRaw,4,6)
  66.             local other2 = string.sub(currentEnergyStoredRaw,7,9)
  67.             print( "After: "..first..","..other1..","..other2)
  68.         end
  69.     end
  70.  
  71.     if currentEnergyStored then
  72.         if string.len( currentEnergyStored ) == 10 then
  73.             --print( "Befor: "..currentEnergyStored )
  74.             local first = string.sub(currentEnergyStoredRaw,1,1)
  75.             local other1 = string.sub(currentEnergyStoredRaw,2,4)
  76.             local other2 = string.sub(currentEnergyStoredRaw,5,7)
  77.             local other3 = string.sub(currentEnergyStoredRaw,8,10)
  78.             print( "After: "..first..","..other1..","..other2..","..other3)
  79.         end
  80.         if string.len( currentEnergyStored ) == 11 then
  81.             --print( "Befor: "..currentEnergyStored )
  82.             local first = string.sub(currentEnergyStoredRaw,1,2)
  83.             local other1 = string.sub(currentEnergyStoredRaw,3,5)
  84.             local other2 = string.sub(currentEnergyStoredRaw,6,8)
  85.             local other3 = string.sub(currentEnergyStoredRaw,9,11)
  86.             print( "After: "..first..","..other1..","..other2..","..other3)
  87.         end
  88.         if string.len( currentEnergyStored ) == 12 then
  89.             --print( "Befor: "..currentEnergyStored )
  90.             local first = string.sub(currentEnergyStoredRaw,1,3)
  91.             local other1 = string.sub(currentEnergyStoredRaw,4,6)
  92.             local other2 = string.sub(currentEnergyStoredRaw,7,9)
  93.             local other3 = string.sub(currentEnergyStoredRaw,10,12)
  94.             print( "After: "..first..","..other1..","..other2..","..other3)
  95.         end
  96.     end
  97.  
  98.     if currentEnergyStored then
  99.         if string.len( currentEnergyStored ) == 13 then
  100.             --print( "Befor: "..currentEnergyStored )
  101.             local first = string.sub(currentEnergyStoredRaw,1,1)
  102.             local other1 = string.sub(currentEnergyStoredRaw,2,4)
  103.             local other2 = string.sub(currentEnergyStoredRaw,5,7)
  104.             local other3 = string.sub(currentEnergyStoredRaw,8,10)
  105.             local other4 = string.sub(currentEnergyStoredRaw,11,13)
  106.             print( "After: "..first..","..other1..","..other2..","..other3..","..other4)
  107.         end
  108.         if string.len( currentEnergyStored ) == 14 then
  109.             --print( "Befor: "..currentEnergyStored )
  110.             local first = string.sub(currentEnergyStoredRaw,1,2)
  111.             local other1 = string.sub(currentEnergyStoredRaw,3,5)
  112.             local other2 = string.sub(currentEnergyStoredRaw,6,8)
  113.             local other3 = string.sub(currentEnergyStoredRaw,9,11)
  114.             local other4 = string.sub(currentEnergyStoredRaw,12,14)
  115.             print( "After: "..first..","..other1..","..other2..","..other3..","..other4)
  116.         end
  117.         if string.len( currentEnergyStored ) == 15 then
  118.             --print( "Befor: "..currentEnergyStored )
  119.             local first = string.sub(currentEnergyStoredRaw,1,3)
  120.             local other1 = string.sub(currentEnergyStoredRaw,4,6)
  121.             local other2 = string.sub(currentEnergyStoredRaw,7,9)
  122.             local other3 = string.sub(currentEnergyStoredRaw,10,12)
  123.             local other4 = string.sub(currentEnergyStoredRaw,13,15)
  124.             print( "After: "..first..","..other1..","..other2..","..other3..","..other4)
  125.         end
  126.     end
  127.  
  128.  
  129. sleep(0)
  130. shell.run("test.sys")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement