Hello folks!, i've been browsing, searching for hours now, tried and tested, done whatever i could do, i have been trying to find/make my code read from another file, that it also eventually should save to, but havent gotten that far yet ^^, the reason i want to do it with another file, is because, the server i play on crash, or if the area aint loaded, the computer needs to be rebooted, and i would like to be able to add new Todo's as i go.
I must admit, this is a stupid and hard wall, and its properly VERY simple, once i get it :b, none the less, heres the code im at.
--[[[Requirements]]]--
component =require("component")event=require("event")
gpu = component.gpu
computer = component.computer
keyboard =require("keyboard")
term =require("term")
fs =require("filesystem")Scolors={ black =0x000000, white =0xf8f8ff, blue =0x0000ff, lightGray =0xd9d9d9, red =0xff0000,
purple =0x9b30ff, carrot =0xffa500, magenta =0xcd00cd, lightBlue =0x87cefa, yellow =0xffff00,
lime =0x32cd32, pink =0xffc0cb, gray =0x696969, brown =0x8b4500, green =0x006400, cyan =0x008b8b,
olive =0x6b8e23, gold =0x8b6914, orangered =0xdb4e02, diamond =0x0fa7c7,crimson =0xaf002a,fuchsia =0xfd3f92,
folly =0xff004f, frenchBlue =0x0072bb, lilac =0x86608e, flax =0xeedc82, darkGray =0x563c5c,
englishGreen =0x1b4d3e, eggplant =0x614051, deepPink =0xff1493, ruby =0x843f5b, orange =0xf5c71a,
lemon =0xffd300, darkBlue =0x002e63, bitterLime =0xbfff00}--[[[Var]]]----Line=4--[[[Tablefor list]]]--Todo={}--[[[Functions]]]--function getTodo()for line in io.lines("TodoList.txt")do
table.insert(Todo, line)endend--[[[ExitKey]]]--functionExit()if x ~=niland y ~=nilthenif x >=12and x <=18and y ==1then
os.exit()
elseif x >=16and x<=20and y ==1then
os.execute("edit todo")endendend--[[[MODE KEY]]]--function mode()
h,w = gpu.getResolution()if x ~=niland y ~=nilthen
gpu.set(h-10,w,"X: ".. x.." Y: ".. y)
os.sleep(1)if x >=1and x <=9and y ==1thenAdd()
os.sleep(1)end
term.clear()
os.sleep(.5)endend--[[[ADD KEY]]]]--functionAdd()
h, w = gpu.getResolution()
gpu.setForeground(Scolors.orange)
gpu.set(1, w,"Enter Todo: ")
term.setCursor(13,w)
data = io.open("TodoList.txt","a")
input = io.read()if input then
data:write(input.."\n")end
data:close()end--[[[ImportKey]]]--functionImport()if x ~=niland y ~=nilthenif x >=24and x <=31and y ==1then
getTodo()Line=1for k,v in pairs (Todo)doLine=Line+1
gpu.set(1,Line,"* "..v)endendendend--[[[CleanKey]]]--function clean()if x ~=niland y ~=nilthenif x >=36and x <=42and y ==1thenLine=2
term.clear()endendend--[[PreSettings]]--
gpu.setBackground(Scolors.gray)
gpu.setForeground(Scolors.orange)
h, w = gpu.maxResolution()
gpu.setResolution(h/2,w/2)
term.clear()Line=1--[[MainLoop]]--whiletruedo
gpu.set(1,1,"Add Todo! - Exit - Edit - Update - Clear")--[[TouchPart]]--
_,_,x,y =event.pull(1,"touch")
mode()Import()Exit()
clean()end
I Really hope theres someone out here, that feels like a good samaritan and help a fella out^^
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hello folks!, i've been browsing, searching for hours now, tried and tested, done whatever i could do, i have been trying to find/make my code read from another file, that it also eventually should save to, but havent gotten that far yet ^^, the reason i want to do it with another file, is because, the server i play on crash, or if the area aint loaded, the computer needs to be rebooted, and i would like to be able to add new Todo's as i go.
I must admit, this is a stupid and hard wall, and its properly VERY simple, once i get it :b, none the less, heres the code im at.
I Really hope theres someone out here, that feels like a good samaritan and help a fella out^^
//Regards Plazter
Link to post
Share on other sites