Posted 29 May 2014 - 09:32 PM
Hello,
I encoured a problem and I tried out a lot but i'm new to multitasking so.
I want to create a "silent" Task which is running separate to the other multitasking stuff.
I looked up in the code of multishell and salvedged some code to create a task called tHack and one for the normal shell:
I am stuck. The code should hide the tHack coroutine and show the tProcess coroutine. Both should get the event Data from the mail loop.
Thanks for you help.
P.S. yes this may be end up in a hacking software for educational purposes
I encoured a problem and I tried out a lot but i'm new to multitasking so.
I want to create a "silent" Task which is running separate to the other multitasking stuff.
I looked up in the code of multishell and salvedged some code to create a task called tHack and one for the normal shell:
local parent = term.native()
local w,h = parent.getSize()
local tHack = {}
local running = true;
local tProcess = {}
local function launch()
--local tProcess = {}
tProcess.window = window.create(parent, 1, 1, w, h, true)
tProcess.terminal = tProcess.window
tProcess.co = coroutine.create( function()
os.run({["shell"] = shell, ["multishell"] = multishell},
"/rom/programs/shell")
--running = false;
end)
tHack.window = window.create(parent, 1, 1, w, h, false)
tHack.co = coroutine.create(function()
while running do
end
end)
end
local function resume(eventD)
coroutine.resume(tHack.co, unpack(eventD))
local ok, result = coroutine.resume(tProcess.co, unpack(eventD))
if ok then
term.redirect(tProcess.terminal)
tProcess.terminal = term.current();
else
launch()
end
end
--events
launch()
term.clear()
term.setCursorPos(1,1)
resume({})
while running do
local eventData = {os.pullEventRaw()}
local event = eventData[1]
resume(eventData)
end
I am stuck. The code should hide the tHack coroutine and show the tProcess coroutine. Both should get the event Data from the mail loop.
Thanks for you help.
P.S. yes this may be end up in a hacking software for educational purposes