Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ X ]]--
- local s = {}
- local op = {}
- --if not fs.exists("XData") then
- fs.makeDir("XData")
- fs.makeDir("/XData/ModData")
- fs.makeDir("/XData/SaveData")
- g = fs.open("/XData/General", "w")
- g.writeLine(2^7) --op[1]
- g.writeLine(2^1) --op[2]
- g.writeLine(2^1) --op[3]
- g.writeLine(2^15) --op[4]
- g.writeLine(2) --op[5]
- g.close()
- s[1] = fs.open("/XData/SaveData/Save1", "w")
- s[2] = fs.open("/XData/SaveData/Save2", "w")
- s[3] = fs.open("/XData/SaveData/Save3", "w")
- s[1].writeLine("New")
- s[2].writeLine("New")
- s[3].writeLine("New")
- s[1].close()
- s[2].close()
- s[3].close()
- --end
- g = fs.open("/XData/General", "r")
- s[1] = fs.open("/XData/SaveData/Save1", "r")
- s[2] = fs.open("/XData/SaveData/Save2", "r")
- s[3] = fs.open("/XData/SaveData/Save3", "r")
- for i=1, 5 do
- op[i] = tonumber(g.readLine())
- end
- file = {
- {
- s[1].readLine();
- };
- {
- s[2].readLine();
- };
- {
- s[3].readLine();
- };
- }
- g.close()
- s[1].close()
- s[2].close()
- s[3].close()
- local stop = false
- local toolbar = true
- local tbts = " [Options] [Controls] [About] [Exit]"
- local space = " "
- local menuNum = 0
- local noFlicker = true
- local pnd = {0, 0, 0, 0, 0}
- local function disp(a)
- crsr = 1
- term.setTextColor(op[4])
- if a=="in" then
- for i=1, string.len(tbts), op[5] do
- term.setBackgroundColor(op[2])
- term.setCursorPos(1, 1)
- write("[+]")
- write(string.sub(tbts, i, -1))
- term.setBackgroundColor(op[1])
- write(space)
- term.setBackgroundColor(2^15)
- term.setCursorPos(2, 2)
- write(string.sub(space, i, -1))
- term.setBackgroundColor(op[1])
- write(space)
- sleep(0.05)
- end
- toolbar = false
- elseif a=="out" then
- for i=1, string.len(tbts), op[5] do
- term.setBackgroundColor(op[2])
- term.setCursorPos(1, 1)
- write("[-]")
- write(string.sub(tbts, -i, -1))
- term.setBackgroundColor(2^15)
- term.setCursorPos(2, 2)
- write(string.sub(space, -i-3, -1))
- sleep(0.05)
- end
- toolbar = true
- end
- if toolbar then
- term.setBackgroundColor(op[2])
- term.setCursorPos(1, 1)
- write("[-]"..tbts)
- term.setBackgroundColor(2^15)
- term.setCursorPos(2, 2)
- write(space)
- else
- term.setBackgroundColor(op[1])
- term.setCursorPos(4, 1)
- write(space)
- term.setCursorPos(5, 2)
- write(space)
- term.setBackgroundColor(op[2])
- term.setCursorPos(1, 1)
- write("[+]")
- term.setBackgroundColor(2^15)
- term.setCursorPos(2, 2)
- write(" ")
- end
- end
- local function anTimeSlider()
- term.setBackgroundColor(op[1])
- term.setCursorPos(24, 4)
- write(" ")
- term.setBackgroundColor(op[4])
- term.setCursorPos(23+dp5, 4)
- write(" ")
- term.setBackgroundColor(op[2])
- term.setCursorPos(35, 4)
- write(" ")
- term.setCursorPos(35, 4)
- if dp5==1 then
- write("Slow")
- elseif dp5==2 then
- write("Normal")
- elseif dp5==3 then
- write("Fast")
- elseif dp5==4 then
- write("Very Fast")
- elseif dp5==5 then
- write("Instant")
- end
- end
- local function colorArrow()
- for i=5, 14, 3 do
- term.setCursorPos(24, i)
- for i2=0, 15 do
- if 2^i2==pnd[i/3-2/3] then
- write("^")
- else
- write(" ")
- end
- end
- end
- end
- local function input(a)
- if a==0 then
- while true do
- event, p1, p2, p3 = os.pullEvent("mouse_click")
- if p2>=9 and p2<=41 and p3>1 then
- if p3>=4 and p3<=6 then
- if p1=="left" then
- --
- break
- else
- window(0, 1, p2, p3) --Menu, Win, X, Y
- end
- elseif p3>=9 and p3<=11 then
- if p1=="left" then
- --
- break
- else
- window(0, 2, p2, p3)
- end
- elseif p3>=14 and p3<=16 then
- if p1=="left" then
- --
- break
- else
- window(0, 3, p2, p3)
- end
- end
- elseif p3==1 then
- if p2>=1 and p2<=3 then
- if toolbar then
- disp("in")
- else
- disp("out")
- end
- elseif p2>=5 and p2<=13 and toolbar then
- menuNum = 1
- toolbar = false
- break
- elseif p2>=15 and p2<=24 and toolbar then
- menuNum = 2
- toolbar = false
- break
- elseif p2>=26 and p2<=32 and toolbar then
- menuNum = 3
- toolbar = false
- break
- elseif p2>=34 and p2<=39 and toolbar then
- stop = true
- break
- end
- end
- end
- elseif a==1 then
- while true do
- event, p1, p2, p3 = os.pullEvent()
- if crsr==1 then
- if event=="mouse_drag" and p2>=24 and p2<=28 and p3==4 then
- dp5 = p2-23
- pnd[5] = dp5
- anTimeSlider()
- elseif event=="mouse_click" and p3==2 then
- if p2>=11 and p2<=15 then
- crsr = 2
- break
- elseif p2>=45 and p2<=48 then
- crsr = 3
- break
- end
- end
- elseif crsr==2 then
- if event=="mouse_click" and p2>=24 and p2<=39 then
- b = p2-24
- c = p3/3-1/3
- if c%1==0 then
- pnd[c] = 2^b
- colorArrow()
- elseif p3==13 then
- pnd[4] = 2^b
- colorArrow()
- end
- elseif event=="mouse_click" and p3==2 then
- if p2>=2 and p2<=9 then
- crsr = 1
- break
- elseif p2>=45 and p2<=48 then
- crsr = 3
- break
- end
- end
- elseif crsr==3 then
- if event=="mouse_click" and p3==12 then
- if p2>=8 and p2<=19 then
- for i=1, 5 do
- if not pnd[i] then
- pnd[i] = op[i]
- else
- op[i] = pnd[i]
- end
- end
- if op[5]==3 then
- op[5] = 5
- elseif op[5]==4 then
- op[5] = 10
- elseif op[5]==5 then
- op[5] = 100
- end
- menuNum = 0
- break
- elseif p2>=29 and p2<=42 then
- menuNum = 0
- break
- end
- elseif event=="mouse_click" and p3==2 then
- if p2>2 and p2<=9 then
- crsr = 1
- break
- elseif p2>=11 and p2<=15 then
- crsr = 2
- break
- end
- end
- end
- end
- end
- end
- local function menu(a)
- if menuNum==0 then
- pnd[1] = op[1]
- pnd[2] = op[2]
- pnd[3] = op[3]
- pnd[4] = op[4]
- pnd[5] = op[5]
- if pnd[5]==5 then
- pnd[5] = 3
- elseif pnd[5]==10 then
- pnd[5] = 4
- elseif pnd[5]==100 then
- pnd[5] = 5
- end
- dp5 = pnd[5]
- if dp5>4 then
- dp5 = 5
- end
- crsr = 1
- term.setTextColor(op[4])
- term.setBackgroundColor(op[1])
- term.clear()
- term.setCursorPos(18, 19)
- write("X, by Symmetryc")
- term.setBackgroundColor(op[3])
- for i=1, 3 do
- c = i*5
- for i2=-1, 1 do
- term.setCursorPos(9, i2+c)
- write(" ")
- term.setCursorPos(42, i2+c+1)
- term.setBackgroundColor(2^15)
- write(" ")
- term.setBackgroundColor(op[3])
- end
- term.setCursorPos(26-string.len(file[i][1])/2, c)
- write(file[i][1])
- term.setBackgroundColor(2^15)
- term.setCursorPos(10, c+2)
- write(" ")
- term.setBackgroundColor(op[3])
- end
- if a==nil then
- disp()
- end
- elseif menuNum==1 or menuNum==2 then
- term.setBackgroundColor(op[2])
- term.setTextColor(op[4])
- term.clear()
- term.setBackgroundColor(op[1])
- term.setCursorPos(1, 1)
- term.clearLine()
- term.setCursorPos(1, 2)
- term.clearLine()
- term.setCursorPos(1, 18)
- term.clearLine()
- term.setCursorPos(1, 19)
- term.clearLine()
- for i=1, 19 do
- term.setCursorPos(1, i)
- write(" ")
- term.setCursorPos(50, i)
- write(" ")
- term.setCursorPos(51, i)
- write(" ")
- end
- term.setBackgroundColor(2^15)
- for i=4, 18 do
- term.setCursorPos(50, i)
- write(" ")
- end
- term.setCursorPos(3, 18)
- write(" ")
- term.setBackgroundColor(op[1])
- term.setCursorPos(3, 1)
- if menuNum==1 then
- write("_______ _____ ____")
- term.setCursorPos(2, 2)
- write("/General\\Color\\ /Exit\\")
- term.setTextColor(op[2])
- if crsr==1 then
- term.setCursorPos(2, 2)
- write("/General\\")
- term.setCursorPos(3, 1)
- write("_______")
- term.setBackgroundColor(op[2])
- term.setTextColor(op[4])
- term.setCursorPos(3, 4)
- write("Animation Speed")
- anTimeSlider()
- elseif crsr==2 then
- term.setCursorPos(10, 2)
- write("/Color\\")
- term.setCursorPos(11, 1)
- write("_____")
- term.setBackgroundColor(op[2])
- term.setTextColor(op[4])
- term.setCursorPos(3, 4)
- write("Background Color")
- term.setCursorPos(3, 7)
- write("Toolbar Color")
- term.setCursorPos(3, 10)
- write("Button Color")
- term.setCursorPos(3, 13)
- write("Text Color")
- for i=4, 13, 3 do
- term.setCursorPos(24, i)
- for i2=0, 15 do
- term.setBackgroundColor(2^i2)
- write(" ")
- end
- end
- term.setBackgroundColor(op[2])
- colorArrow()
- elseif crsr==3 then
- term.setCursorPos(44, 2)
- write("/Exit\\")
- term.setCursorPos(45, 1)
- write("____")
- term.setBackgroundColor(op[2])
- term.setTextColor(op[4])
- term.setCursorPos(8, 7)
- write("Would you like to save you changes?")
- term.setCursorPos(8, 12)
- write("Save Changes Cancel Changes")
- end
- elseif menuNum==2 then
- write("_______ ____")
- end
- end
- if a==nil then
- input(menuNum)
- end
- end
- menu(true)
- disp("out")
- input(0)
- while true do
- menu()
- g = fs.open("/XData/General", "w")
- s[1] = fs.open("/XData/SaveData/Save1", "w")
- s[2] = fs.open("/XData/SaveData/Save2", "w")
- s[3] = fs.open("/XData/SaveData/Save3", "w")
- g.writeLine(op[1])
- g.writeLine(op[2])
- g.writeLine(op[3])
- g.writeLine(op[4])
- g.writeLine(op[5])
- g.close()
- for i=1, 3 do
- s[i].writeLine(file[i][1])
- s[i].close()
- end
- if stop==true then
- term.setBackgroundColor(2^15)
- term.setTextColor(2^0)
- term.clear()
- term.setCursorPos(1, 1)
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement