This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Beaus1966's profile picture

user friendly to do list

Started by Beaus1966, 27 June 2013 - 03:13 PM
Beaus1966 #1
Posted 27 June 2013 - 05:13 PM
When I want to edit my to do list I need to edit the program and then reboot, I made the to do list I an just looking for a separate program that will ask questions like what line and then you can edit the line then when you are done it will automatically reboot.
Lyqyd #2
Posted 27 June 2013 - 09:52 PM
Split into new topic.

Please post your existing code and any error messages you receive while running it.
Zudo #3
Posted 28 June 2013 - 02:59 AM
I was bored, and feeling kind. If you wanted to save the to-do list in a file try something like this:


if not fs.exists("todo") then
handle = fs.open("todo", "w")
handle.writeLine("{}")
handle.close()
end

handle = fs.open("todo", "r")
todo = textutils.unserialize(handle.readLine())
handle.close()

term.clear()
term.setCursorPos(1,1)
print("To-do list")
print("Please enter the item number in the to-do list")
n = tonumber(read())
if type(n) == "nil" then term.clear() term.setCursorPos(1,1) error("That was not a number", 0) end
term.clear()
term.setCursorPos(1,1)
if not todo[n] then
 print("Current value: nil" )
 print("Please enter the new value")
 new = read()
 todo[n] = new
else
 print("Current value: " .. todo[n] )
 print("Please enter the new value")
 new = read()
 todo[n] = new
end

handle = fs.open("todo", "w")
handle.writeLine(textutils.serialize(todo))
handle.close()

You might get bad responses if you ask for people to make you programs in this forum. :)/>
Beaus1966 #4
Posted 28 June 2013 - 08:42 AM
Thanks, ZodoHackz I will try that, is that everything or just the editor?
Beaus1966 #5
Posted 28 June 2013 - 08:44 AM
No error messages, paste bin code will be posted shortly

Code is: KeQMhB6M
Beaus1966 #6
Posted 28 June 2013 - 09:15 AM
ZodoHackz i get an error message, attempt to concatenate string and nil
Zudo #7
Posted 28 June 2013 - 12:12 PM
ZodoHackz i get an error message attempt to concatenate string and nil

I know, I will edit it!
EDIT: done!
Beaus1966 #8
Posted 28 June 2013 - 05:39 PM
You edited the code a couple posts above? And what do I name the programs(s)?
oWave #9
Posted 28 June 2013 - 05:48 PM
How about 'ToDo'?
Beaus1966 #10
Posted 28 June 2013 - 09:41 PM
Sorry but is that the displayer to the monitor and the editor. Or is it just the editor????




Thanks for your time
Tjakka5 #11
Posted 29 June 2013 - 12:51 AM
You might want to have a look at my Todo program then, it has a simple editor that could get you started.

pastebin.com/vFaHf7K
Beaus1966 #12
Posted 29 June 2013 - 09:57 AM
Thanks I will check it out!


Did you enter the code wrong???
Beaus1966 #13
Posted 29 June 2013 - 11:29 AM
i read up on lua and made one!!!