jakendrick3

Jenisis OC

Feb 23rd, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.57 KB | None | 0 0
  1. term = require("term")
  2. shell = require("shell")
  3. internet = require("internet")
  4. keyboard = require("keyboard")
  5. event = require("event")
  6. os = require("os")
  7.  
  8. jenisis = {}
  9.  
  10. function jenisis.drawScreen(staticScreen, tableScreen)
  11.   running = true
  12.   rkeyp = true
  13.   cselected = 1
  14.   num = 1
  15.   static = true
  16.  
  17.   while running == true do
  18.     term.clear()
  19.     term.setCursor(1, 1)
  20.    
  21.     rkeyp = true
  22.     isPrint = true
  23.     num = 1
  24.    static = true
  25.     staticNum = 1
  26.     param = "nulll"
  27.  
  28.    while static == true do
  29.      line = staticScreen[staticNum]
  30.      if line ~= nil then
  31.      print(line)
  32.      staticNum = staticNum + 1
  33.      else
  34.      static = false
  35.      end
  36.    end
  37.  
  38.    num = 1
  39.     print(" ")
  40.  
  41.     while isPrint == true do
  42.       line = tableScreen[num]
  43.       if line ~= nil and num ~= cselected then
  44.         print(line)
  45.         num = num + 1
  46.       elseif line ~= nil and num == cselected then
  47.         print("["..line.."]")
  48.         num = num + 1
  49.       else
  50.         isPrint = false
  51.       end
  52.     end
  53.    
  54.     while rkeyp == true do
  55.       ev, p1, p2, key = event.pull(5, "key_down")
  56.       if key == 200 then
  57.         cselected = cselected - 1
  58.         if cselected <= 0 then
  59.           cselected = num - 1
  60.         end
  61.         rkeyp = false
  62.       elseif key == 208 then
  63.         cselected = cselected + 1
  64.         if cselected >= num then
  65.           cselected = 1
  66.         end
  67.         rkeyp = false
  68.       elseif key == 28 then
  69.         return cselected
  70.       elseif key == 15 then
  71.         return 999
  72.       end
  73.     end
  74.   end
  75. end
  76.  
  77. return jenisis
Add Comment
Please, Sign In to add comment