Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --CONFIG:
- --remove 1 - to disable mutlishell
- ---[[
- useMultishell = true
- --]]
- if term.noColorVersion then
- return
- end
- term.redirect(term.native())
- local mShell = multishell
- local oShell = shell
- multishell = nil
- shell = nil
- print(multishell)
- print(shell)
- --load redirect
- os.loadAPI"redirect"
- --m,ake a new buffer
- local w,h = term.getSize()
- local ter = redirect.createRedirectBuffer(w,h,0,0,true)
- local w,h = term.getSize()
- local bb = false
- local tb = false
- local bw = false
- local tw = false
- local setTextColor = ter.setTextColor
- local setBackgroundColor = ter.setBackgroundColor
- function term.isColor()
- return true
- end
- function term.isColour()
- return true
- end
- function term.setTextColor(c)
- if c ~= colors.white and c ~= colors.black then
- c = colors.white
- end
- if bb == true then
- c = colors.white
- end
- if bw == true then
- c = colors.black
- end
- if c == colors.black then
- tb = true
- else
- tb = false
- end
- if c == colors.white then
- tw = true
- else
- tw = false
- end
- return setTextColor(c)
- end
- --local bb = false
- function term.setBackgroundColor(c)
- if c ~= colors.white and c ~= colors.black then
- c = colors.black
- end
- if c == colors.black then
- bb = true
- else
- bb = false
- end
- if c == colors.white then
- bw = true
- else
- bw = false
- end
- if tb == true then
- c = colors.white
- end
- if tw == true then
- c = colors.black
- end
- return setBackgroundColor(c)
- end
- ter.setTextColour = ter.setTextColor
- ter.setBackgroundColour = ter.setBackgroundColor
- function term.usingNoColor()
- return true
- end
- ter.usingNoColour = ter.usingNoColor
- UsingNoColor = ter.usingNoColor
- UsingNoColour = ter.usingNoColor
- function term.noColorVersion()
- return "v1-M"--version 1 modded
- end
- ter.noColourVersion = ter.noColorVersion
- NoColourVersion = ter.noColorVersion
- NoColorVersion = ter.noColorVersion
- --function ter.native() return ter end
- local native = term.current()
- --ter = term.current()
- term.clear()
- term.redirect(ter)
- term.clear()
- term.setCursorPos(1,1)
- --[[code:
- 1 - started mousepress
- table -- returning event
- 2 - user wants 'alt']]
- local shellCo = coroutine.create(function()
- if useMultishell then
- os.run({},"rom/programs/advanced/multishell")
- else
- os.run({},"rom/programs/shell")
- end
- end)
- --[[mouse = coroutine.create(function()
- local inform
- local x
- local y
- local w,h = term.getSize()
- while true do
- local a={coroutine.yield(inform)}
- end
- end
- end)]]
- os.queueEvent"ignoreThis"
- function p(a,b,c,d,e,f,g) if false then write(a or ""..b or ""..c or ""..d or ""..e or ""..f or ""..g or "") end end
- local nextEvent
- local x,y = 1,1
- while coroutine.status(shellCo)=="suspended" do
- --print"1"
- local a
- if nextEvent then
- --p(nextEvent)
- --sleep(1)
- a = nextEvent
- else
- a = {coroutine.yield()}
- end
- --print"2"
- --print"2.5"
- nextEvent = nil
- --nextEvent things:
- if a[1] =="key" and a[2]==56 then --alt
- local px,py = term.getCursorPos()--cursor pos before moving
- term.setCursorBlink(false)
- term.setBackgroundColor(colors.black)
- term.redirect(native)
- term.setTextColor(colors.white)
- term.setCursorPos(x,y)
- write"X"
- while true do
- local a = {coroutine.yield()}
- if a[1]=="key" then
- if a[2]==200 then --up
- if not (y<=1) then
- y=y-1
- end
- elseif a[2]==208 then --down
- if not (y>=h) then
- y=y+1
- end
- elseif a[2]==203 then --left
- if not (x<=1) then
- x=x-1
- end
- elseif a[2]==205 then --right
- if not (x>=w) then
- x=x+1
- end
- elseif a[2]==56 then
- nextEvent = {"key",56}--alt
- break
- elseif a[2]==28 then --enter
- nextEvent ={"mouse_click",1,x,y}--m1 at x,y
- break
- elseif a[2]==54 then --shift
- nextEvent = {"mouse_click",2,x,y}--m2 at x,y
- break
- end
- end
- --draw it
- term.redirect(native)
- ter.blit()--draw the screen
- p(x,y)
- term.setCursorPos(x,y)
- write"X"
- end
- ter.blit()
- term.setCursorPos(px,py)
- else
- term.redirect(ter)
- coroutine.resume(shellCo,unpack(a))
- end
- term.redirect(native)
- ter.blit()
- end
- term.redirect(native)
- print"Completed."
- multishell = mShell
- shell = oShell
Advertisement
Add Comment
Please, Sign In to add comment