i want them to pause the function where it says
--DO SOMETHING HERE TO GO BACK TO BLA BLA BLA
then continue the function when it gets back to ithere is the code
and a brief explanation to what it should do
so the display function will always look if an variable like his changes if so then print the suggested variable and the prompt will take in user commands and send it to the display so the display show it and the last thing is the handler with checks if it founds a peripheral attached to it if so send that to the display
code
local w,h = term.getSize()
uis = true
ui = "Startup"
his = false
hi = "none"
comm = none
drive = false
drivepos = "none"
function setup()
term.setBackgroundColor(colors.lightGray)
print("cleaning")
term.setCursorPos(1, 1)
term.clear()
gui()
end
function gui()
paintutils.drawFilledBox(1, 1, 90, 2, colors.orange)
term.setCursorPos(math.floor(w-string.len("Console OS 2.1"))/2, 2)
term.setTextColor(colors.white)
print("Console OS 2.1")
end
function display()
buf = window.create(term.current(),1,3,51,17)
buf.setBackgroundColor(colors.lightGray)
oldterm = term.redirect(buf)
term.clear()
while true do
sleep(0.5)
print("Ye")
if uis == true then uis = false
print("User: "..ui)
--coroutine.yield()
--HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER
elseif his == true then his = false
print(hi)
--coroutine.yield()
--HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER
else
--coroutine.yield()
--HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER
end
end
end
function prompt()
--sleep(0.5)
buff = window.create(term.current(),1,17,51,1)
buff.setBackgroundColor(colors.gray)
oldterm = term.redirect(buff)
while true do
term.setCursorPos(1, 1)
term.clear()
write(">> ")
local com = read()
ui = com
--coroutine.yield()
--HERE DO SOMETHING TO GO BACK TO DISPLAY OR HANDLER
end
end
function handler()
while true do
sleep(0.5)
left = peripheral.isPresent("left")
right = peripheral.isPresent("right")
bottom = peripheral.isPresent("bottom")
top = peripheral.isPresent("top")
front = peripheral.isPresent("front")
back = peripheral.isPresent("back")
if left == true then
his = true
drivepos = "left"
drive = true
elseif right == true then
his = true
drivepos = "right"
drive = true
hi = ("Detected drive "..drivepos)
else
drive = false
end
--HERE DO SOMETHING TO GO BACK TO PROMPT OR DISPLAY
end
end
setup()
parallel.waitForAny(display, prompt, handler)
--display()
--prompt()
Any help is useful