Atom888

Nano - Shell API

Dec 2nd, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.88 KB | None | 0 0
  1. function C()
  2.    term.clear()
  3. end
  4.  
  5. function CP(x,y)
  6.    term.setCursorPos(x,y)
  7. end
  8.  
  9. function BC(bgC)
  10.    term.setBackgroundColor(bgC)
  11. end
  12.  
  13. function TC(ttC)
  14.    term.setTextColor(ttC)
  15. end
  16.  
  17. function Write(text,Wx,Wy,Wbc,Wtc)
  18.    CP(Wx,Wy)
  19.    BC(Wbc)
  20.    TC(Wtc)
  21.    term.write(text)
  22. end
  23.  
  24. function Input(text,rd,Ix,Iy,Ibc,Itc)
  25.    CP(Ix,Iy)
  26.    BC(Ibc)
  27.    TC(Itc)
  28.    term.write(text)
  29.    return read(rd)
  30. end
  31.  
  32. function F(Fy,Fcol)
  33.    Write("                                                                                                        ",1,Fy,Fcol,Fcol)
  34. end
  35.  
  36. function FS(fillCol,effect,eTime)
  37.    y = 1        
  38.    if effect then
  39.       for y = 1,19 do
  40.          F(y,fillCol)
  41.          sleep(eTime)
  42.       end
  43.    elseif not effect then
  44.       for y = 1,19 do
  45.          F(y,fillCol)
  46.       end
  47.    end
  48. end
  49.  
  50. function ShellEvent(evt)
  51.    a,b,c,d = os.pullEventRaw()
  52.    if a == evt then
  53.       return b,c,d
  54.    end      
  55. end
  56.  
  57. function ShellEventAdv(a,b,c,d,e,f)
  58.    evt,button,x,y = os.pullEventRaw()
  59.    if evt == a then
  60.       if button == b then
  61.          if x >= c then
  62.             if x <= d then
  63.                if y >= e then
  64.                   if y <= f then
  65.                      return true
  66.                   else
  67.                      return false
  68.                   end
  69.                else
  70.                   return false
  71.                end
  72.             else
  73.                return false
  74.             end
  75.          else
  76.             return false
  77.          end
  78.       else
  79.          return false
  80.       end
  81.    else
  82.       return false
  83.    end
  84. end
  85.  
  86. function PastebinGet(PBcode,Fpath)
  87.    http.get(PBcode,Fpath)
  88. end
  89.  
  90. function FsDel(Fpath)
  91.    fs.delete(Fpath)
  92. end
  93.  
  94. function FsMkdir(dir)
  95.    fs.makeDir(dir)
  96. end
  97.  
  98. function FsExists(file)
  99.    return fs.exists(file)
  100. end
  101.  
  102. function OsReboot()
  103.    os.reboot()
  104. end
  105.  
  106. function OsShutdown()
  107.    os.shutdown()
  108. end
  109.  
  110. function Api(api)
  111.    os.loadAPI(api)
  112. end
  113.  
  114. function Image(Image,x,y)
  115.    img = paintutils.loadImage(Image)
  116.    paintutils.drawImage(img,x,y)
  117. end
  118.  
  119. function Button(text,x,midY,bgC,ttC)
  120.    for x1 = x,(x + (string.len(text))) + 1 do
  121.       Write(" ",x1,midY - 1,bgC,ttC)
  122.    end
  123.    Write(" "..text.." ",x,midY,bgC,ttC)
  124.    for x1 = x,(x + (string.len(text))) + 1 do
  125.       Write(" ",x1,midY + 1,bgC,ttC)
  126.    end
  127. end
  128. function Users()
  129.    local file = fs.open("/ProgramFiles/Nano/Users/Data/Logon/List")
  130.    data = file.readAll()
  131.    return data
  132. end
  133. function UserExsists(usr,data)
  134.    if usr in data then
  135.       return true
  136.    else
  137.       return false
  138.    end
  139. end
Add Comment
Please, Sign In to add comment