Advertisement
sniki10

Menu

Aug 9th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. opcje = {}
  2. wybor = 1
  3. opcje[1] = "Wylacz komputer"
  4. opcje[2] = "Zrestartuj komputer"
  5. opcje[3] = "Pokaz moje programy"
  6. opcje[4] = "Narysuj cos"
  7. opcje[5] = "Pokaz wszystkie programy"
  8. opcje[6] = "Zagraj w weza"
  9. opcje[7] = "Przejdz do trybu ,,Lua,,"
  10. opcje[8] = "Wyswietl czas gry"
  11. opcje[9] = "Zagraj w ,,Przygode,,"
  12. opcje[10] = "Zamknij menu"
  13.  
  14.  
  15.  
  16.  
  17. function uruchom(numer)
  18. if numer == 1 then
  19. shell.run("shutdown")
  20. elseif numer == 2 then
  21. shell.run("koniec")
  22. elseif numer == 3 then
  23. shell.run("ls")
  24. elseif numer == 4 then
  25. shell.run("paint oVca")
  26. elseif numer == 5 then
  27. shell.run("programs")
  28. elseif numer == 6 then
  29. shell.run("worm")
  30. elseif numer == 7 then
  31. shell.run("lua")
  32. elseif numer == 8 then
  33. shell.run("time")
  34. elseif numer == 8 then
  35. shell.run("adventure")
  36. elseif numer == 10 then
  37. else
  38. wybor = 1
  39. return menu()
  40.  
  41. end
  42. end
  43. function przycisk()
  44. sleep(0.05)
  45. event, argument = os.pullEvent()
  46. if event == "key" then
  47. if argument == 28 then
  48. return uruchom(wybor)
  49. elseif argument == 200 then
  50. if wybor == 1 then
  51. else
  52. wybor = wybor - 1
  53. end
  54. elseif argument == 208 then
  55. if wybor == table.getn(opcje) then
  56. else
  57. wybor = wybor + 1
  58. end
  59. else
  60. return przycisk()
  61. end
  62. else
  63. return przycisk()
  64. end
  65. return menu()
  66. end
  67.  
  68. function menu()
  69. shell.run("clear")
  70. for i=1, table.getn(opcje) do
  71. if wybor == i then
  72. print("-> "..opcje[i].." <-")
  73. else
  74. print(opcje[i])
  75. end
  76. end
  77. return przycisk()
  78. end
  79.  
  80. shell.run("clear")
  81. return menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement