Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- menu = 1
- x,y = term.getSize()
- char = "^"
- if not fs.exists("N-LeafG") then
- fs.makeDir("N-LeafG")
- end
- function Message(text, text2)
- for i=1,x-1 do
- term.setCursorPos(i, y-3)
- write("-")
- end
- term.setCursorPos(1, y-2)
- print(text)
- term.setCursorPos(1, y-1)
- print(text2)
- local event, a, b = os.pullEvent("key")
- for i=1,x-1 do
- term.setCursorPos(i, y-3)
- write(" ")
- end
- for i=1,x-1 do
- term.setCursorPos(i, y-2)
- write(" ")
- end
- for i=1,x-1 do
- term.setCursorPos(i, y-1)
- write(" ")
- end
- end
- local function cPrint(text)
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- print(text)
- end
- function game()
- if not fs.exists("N-LeafG/player") then
- term.clear()
- term.setCursorPos(1,y-3)
- Message("Hello, there!", "Glad to meet you!")
- Message("Welcome to the world of NeXiMoN", "My name is OAK.")
- Message("This world...", "")
- Message("...is inhabited far and wide by", "creatures called NeXiMon.")
- Message("But first,", "tell me about yourself.")
- Message("Lets begin with your name.", "What is it?")
- term.clear()
- term.setCursorPos(1,1)
- print("YOUR NAME?")
- input = read()
- term.clear()
- Message("Ah, I remember now.", "Hello " ..input)
- term.clear()
- term.setCursorPos(1,1)
- print("P")
- Message("This is my grandson.", "")
- Message("He's been your rival since you both", "were kids.")
- Message("Erm... What was his name again?", "")
- term.clear()
- term.setCursorPos(1,1)
- print("RIVAL'S NAME?")
- input2 = read()
- term.clear()
- term.setCursorPos(x/2, y/2)
- write("^")
- Message("A world of dreams and adventures", "with NeXiMon awaits! Let's go!")
- name = fs.open("N-LeafG/player", "r")
- name.write(input)
- name.close()
- lol = fs.open("N-LeafG/rival", "r")
- lol.write(input2)
- lol.close()
- end
- end
- function start()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("NeXiMoN Leaf Green")
- cPrint("")
- if menu == 1 then
- cPrint("[ Load Game ]")
- else cPrint("Load Game") end
- if menu == 2 then
- cPrint("[ Reset Data ]")
- else cPrint("Reset Data") end
- if menu == 3 then
- cPrint("[ Quit ]")
- else cPrint("Quit") end
- end
- start()
- while true do
- local e,key = os.pullEvent( "key" )
- if key == 17 or key == 200 then
- if menu > 1 then
- menu = menu - 1
- start()
- end
- elseif key == 31 or key == 208 then
- if menu < 3 then
- menu = menu + 1
- start()
- end
- elseif key == 28 then
- break
- end
- end
- if menu == 3 then
- os.reboot()
- elseif menu == 2 then
- term.clear()
- term.setCursorPos(1,1)
- write("Are you sure? (y/n)")
- input = read()
- if input == "y" then
- shell.run("rm", "N-LeafG")
- print("Deleted!")
- sleep(1)
- os.reboot()
- else
- os.reboot()
- end
- elseif menu == 1 then
- game()
- end
Advertisement
Add Comment
Please, Sign In to add comment