http://pastebin.com/cXS6MJnm
Unfortunately both threads aren't running at the same time, and as a result the clock isn't updating. If anyone can help me I would really appreciate it. Thanks in advance
Posted 17 October 2014 - 02:35 AM
Posted 17 October 2014 - 03:16 AM
function thread3(x,y) while true do local time = os.time() formatedTime = textutils.formatTime(time, false) term.setCursorPos(x,y) write(formatedTime) sleep(5) end end
Edited by valithor, 17 October 2014 - 03:43 AM.
Posted 17 October 2014 - 03:08 PM
valithor, on 17 October 2014 - 03:16 AM, said:
function thread3(x,y) while true do local time = os.time() formatedTime = textutils.formatTime(time, false) term.setCursorPos(x,y) write(formatedTime) sleep(5) end end
-- You're code....
-- Functionise it all so it can be reused. For example:
-- You can have a menu in function menu() -- code end and your different menu options in there own function!]]
-- and now the function:
function help()
-- This can be / do whatever you want!
-- For example show a help menu/screen!
end
function programs()
-- This can be/do whatever you want!
-- For example show the list of programs!
end
function shutdown()
-- This can do / be whatever you want!
-- For example shutdown the computer!
end
function drawTime()
nTime = textutils.formatTime(os.time())
-- print time where ever: example top left corner:
term.setCursorPos(1,1)
print(nTime)
-- start timer for a second to update clock:
os.startTimer(1)
end
function menu()
while true do
drawTime()
local args = { os.pullEvent() }
if args[1] == "timer" then
drawTime()
elseif args[1] == "char" then
if args[2] == "1" then
-- do something for menu item 1 example go to: the help screen:
help()
elseif args[2] == "2" then
-- do something for menu item 2 example go to: programs:
programs()
elseif args[2] == "3" then
-- do something for menu item 3 example go to: shutdown:
shutdown()
end
end
end
end
-- make sure to the call the menu (or function you're using as the main entry point) function at the bottom, so it runs through all the functions and registers them.
menu()
Edited by DannySMc, 17 October 2014 - 03:13 PM.
Posted 17 October 2014 - 07:40 PM
Posted 18 October 2014 - 02:10 AM
0 members, 1 guests, 0 anonymous users