Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local serverID = 435
- isBlinkin = false
- currentBGColor = colors.black
- currentTColor = colors.white
- screenData = {}
- oldWrr = term.write
- term.write = function( strr )
- local x,y = term.getCursorPos()
- screenData[ #screenData+1 ] = {
- ["x"] = x,
- ["y"] = y,
- ["text"] = strr,
- ["color"] = currentTColor,
- ["bgcolor"] = currentBGColor,
- }
- return oldWrr( strr )
- end
- oldClrr = term.clear
- term.clear = function()
- screenData = {}
- return oldClrr()
- end
- oldBG = term.setBackgroundColour
- oldTC = term.setTextColour
- oldBlinkah = term.setCursorBlink
- oldCursorPos = term.setCursorPos
- term.setBackgroundColour = function( colah )
- currentBGColor = colah
- return oldBG( colah )
- end
- term.setTextColour = function( colah )
- currentTColor = colah
- return oldTC( colah )
- end
- term.setCursorBlink = function( yezornu )
- isBlinkin = yezornu
- return oldBlinkah( yezornu )
- end
- function a()
- term.clear()
- term.setCursorPos(1,1)
- shell.run("shell")
- end
- function b()
- rednet.open("top")
- rednet.open("back")
- rednet.open("left")
- rednet.open("right")
- rednet.open("front")
- rednet.open("bottom")
- while true do
- local id, message = rednet.receive()
- if id == serverID and message == "getScreen" then
- rednet.send( id, textutils.serialize( screenData ) )
- elseif id == serverID and message == "getBlink" then
- rednet.send( id, textutils.serialize( isBlinkin ) )
- elseif id == serverID and message == "getPos" then
- local x,y = term.getCursorPos()
- local pos = {
- ["x"] = x,
- ["y"] = y,
- }
- rednet.send( id, textutils.serialize( pos ) )
- elseif id == serverID and message == "getColz" then
- local colz = {
- ["bg"] = currentBGColor,
- ["tc"] = currentTColor,
- }
- rednet.send( id, textutils.serialize( colz ) )
- elseif id == serverID and string.find( message, ":" ) then
- local tWords = {}
- for match in string.gmatch( message, "[^:\t]+" ) do
- table.insert( tWords, match )
- end
- os.queueEvent( tWords[1], tWords[2], tWords[3], tWords[4], tWords[5], tWords[6] )
- end
- end
- end
- parallel.waitForAny( a, b )
Advertisement
Add Comment
Please, Sign In to add comment