xXm0dzXx

Untitled

Apr 23rd, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. menu = 1
  2. x,y = term.getSize()
  3. char = "^"
  4.  
  5. if not fs.exists("N-LeafG") then
  6. fs.makeDir("N-LeafG")
  7. end
  8.  
  9. function Message(text, text2)
  10. for i=1,x-1 do
  11. term.setCursorPos(i, y-3)
  12. write("-")
  13. end
  14.  
  15. term.setCursorPos(1, y-2)
  16. print(text)
  17. term.setCursorPos(1, y-1)
  18. print(text2)
  19. local event, a, b = os.pullEvent("key")
  20. for i=1,x-1 do
  21. term.setCursorPos(i, y-3)
  22. write(" ")
  23. end
  24. for i=1,x-1 do
  25. term.setCursorPos(i, y-2)
  26. write(" ")
  27. end
  28. for i=1,x-1 do
  29. term.setCursorPos(i, y-1)
  30. write(" ")
  31. end
  32. end
  33.  
  34. local function cPrint(text)
  35. local x2,y2 = term.getCursorPos()
  36. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  37. print(text)
  38. end
  39.  
  40. function game()
  41. if not fs.exists("N-LeafG/player") then
  42. term.clear()
  43. term.setCursorPos(1,y-3)
  44. Message("Hello, there!", "Glad to meet you!")
  45. Message("Welcome to the world of NeXiMoN", "My name is OAK.")
  46. Message("This world...", "")
  47. Message("...is inhabited far and wide by", "creatures called NeXiMon.")
  48. Message("But first,", "tell me about yourself.")
  49. Message("Lets begin with your name.", "What is it?")
  50. term.clear()
  51. term.setCursorPos(1,1)
  52. print("YOUR NAME?")
  53. input = read()
  54. term.clear()
  55. Message("Ah, I remember now.", "Hello " ..input)
  56. term.clear()
  57. term.setCursorPos(1,1)
  58. print("P")
  59. Message("This is my grandson.", "")
  60. Message("He's been your rival since you both", "were kids.")
  61. Message("Erm... What was his name again?", "")
  62. term.clear()
  63. term.setCursorPos(1,1)
  64. print("RIVAL'S NAME?")
  65. input2 = read()
  66. term.clear()
  67. term.setCursorPos(x/2, y/2)
  68. write("^")
  69. Message("A world of dreams and adventures", "with NeXiMon awaits! Let's go!")
  70. name = fs.open("N-LeafG/player", "r")
  71. name.write(input)
  72. name.close()
  73. lol = fs.open("N-LeafG/rival", "r")
  74. lol.write(input2)
  75. lol.close()
  76. end
  77. end
  78.  
  79. function start()
  80. term.clear()
  81. term.setCursorPos(1,1)
  82. cPrint("NeXiMoN Leaf Green")
  83. cPrint("")
  84. if menu == 1 then
  85. cPrint("[ Load Game ]")
  86. else cPrint("Load Game") end
  87.  
  88. if menu == 2 then
  89. cPrint("[ Reset Data ]")
  90. else cPrint("Reset Data") end
  91.  
  92. if menu == 3 then
  93. cPrint("[ Quit ]")
  94. else cPrint("Quit") end
  95. end
  96.  
  97. start()
  98.  
  99. while true do
  100. local e,key = os.pullEvent( "key" )
  101. if key == 17 or key == 200 then
  102. if menu > 1 then
  103. menu = menu - 1
  104. start()
  105. end
  106. elseif key == 31 or key == 208 then
  107. if menu < 3 then
  108. menu = menu + 1
  109. start()
  110. end
  111. elseif key == 28 then
  112. break
  113. end
  114. end
  115.  
  116. if menu == 3 then
  117. os.reboot()
  118. elseif menu == 2 then
  119. term.clear()
  120. term.setCursorPos(1,1)
  121. write("Are you sure? (y/n)")
  122. input = read()
  123. if input == "y" then
  124. shell.run("rm", "N-LeafG")
  125. print("Deleted!")
  126. sleep(1)
  127. os.reboot()
  128. else
  129. os.reboot()
  130. end
  131. elseif menu == 1 then
  132. game()
  133. end
Advertisement
Add Comment
Please, Sign In to add comment