svdragster

settings

Mar 16th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. function fileTableGet(path)
  2.     if fs.exists(path) then
  3.         local file = io.open(path, "r")
  4.         local lines = {}
  5.         local i = 1
  6.         local line = file:read("*l")
  7.         while line ~= nil do
  8.             lines[i] = line
  9.             line = file:read("*l")
  10.             i = i + 1
  11.         end
  12.         file:close()
  13.         return lines
  14.     end
  15.     return {}
  16. end
  17.  
  18. function fileLineGet(path, line)
  19.     if fs.exists(path) then
  20.         local lines = fileTableGet(path)
  21.         return lines[line]
  22.     end
  23.     return ""
  24. end
  25.  
  26. function bg(bg)
  27.     term.setBackgroundColour( colors.green )
  28.     term.clear()
  29.     term.setTextColour(colors.cyan)
  30.     term.setCursorPos(2,2)
  31.     print("PSAV - BETA")
  32.     term.setCursorPos(51,1)
  33.     term.setBackgroundColour( colors.red )
  34.     print("x")
  35.     term.setCursorPos(1,1)
  36.     write("<-")
  37.     term.setBackgroundColour( colors.green )
  38.     term.setCursorPos(2,5)
  39.     term.setTextColour( colors.cyan )
  40.    
  41. end
  42.  
  43. bg()
  44.  
  45. fertig = false
  46. startup = false
  47.  
  48. term.setCursorPos(1,5)
  49. write("Start PSAV on startup?")
  50. term.setCursorPos(25,5)
  51. term.setBackgroundColour( colors.white )
  52. write(" ")
  53. term.setTextColour( colors.red )
  54.  
  55. while fertig == false do
  56.   event, knopf, x, y = os.pullEvent("mouse_click")
  57.  
  58. --Start PSAV on startup?
  59.   if (x == 25) and (y == 5) then
  60.     term.setCursorPos(25,5)
  61.     if (startup == false) then
  62.       print("x")
  63.       startup = true
  64.     else
  65.       print(" ")
  66.       startup = false
  67.     end
  68.   end
  69.  
  70. --Pfeil
  71.   if (x == 1) or (x == 2) and (y == 1) then
  72.     fertig = true
  73.     shell.run("/PSAV/psav")
  74.   end
  75.  
  76. --Klicken auf X / Beenden
  77.   if (x  == 51) and (y == 1) then
  78.     fertig = true
  79.     term.setBackgroundColour( colors.black )
  80.     term.clear()
  81.     term.setCursorPos(1,1)
  82.     shell.run(fileLineGet("/PSAV/config/config.txt", 2))
  83.   end
  84. end
  85.  
  86.  
  87.  
  88. shell.run("/PSAV/psav")
Advertisement
Add Comment
Please, Sign In to add comment