Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x,y = term.getSize()
- local currentID = 0
- local function cPrint(text)
- x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- write(text.. "\n")
- end
- local function lWrite(text)
- x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil( x - (text:len()-1) ), y2)
- write(text)
- end
- term.clear()
- term.setCursorPos(1,3)
- cPrint("xXm0dzXx")
- cPrint("RAT Services")
- print()
- cPrint("+---Select a computer---+")
- local ids = {}
- rednet.broadcast( "getText" )
- timer = os.startTimer(0)
- repeat
- local event, key, id = os.pullEvent()
- if event == "rednet_message" then
- ids[#ids+1] = key
- end
- until event == "timer" and key == timer
- function addButton( curType, disID, text )
- local x2,y2 = term.getCursorPos()
- if disID == curType then
- yer = "X"
- else
- yer = " "
- end
- cPrint("| [" ..yer.. "]|")
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- write("| " ..text)
- end
- selection = 1
- clockeroo = os.startTimer(0.05)
- while true do
- term.clear()
- term.setCursorPos(1,3)
- cPrint("xXm0dzXx")
- cPrint("RAT Services")
- print()
- cPrint("+---Select a computer---+")
- if #ids == 0 then
- cPrint("| No Computers Found, |")
- cPrint("| Enter a id: |")
- cPrint("+-----------------------+")
- currentID = tonumber(read())
- break
- end
- for i=1,#ids do
- v = ids[i]
- addButton( selection, i, "#" ..v )
- end
- cPrint("+-----------------------+")
- term.setCursorPos(1,y)
- lWrite( textutils.formatTime( os.time() ) )
- local event, key = os.pullEvent()
- if event == "key" then
- if key == keys.up and selection ~= 1 then
- selection = selection -1
- elseif key == keys.down and selection ~= #ids then
- selection = selection +1
- elseif key == keys.enter then
- currentID = ids[ selection ]
- break
- end
- elseif event == "timer" then
- clockeroo = os.startTimer(0.05)
- end
- end
- term.clear()
- term.setCursorPos(1,3)
- cPrint("+---CONNECTING---+")
- cPrint("| Please wait :D |")
- cPrint("+----------------+")
- sleep(1)
- function getFrom( msg, idz )
- repeat
- rednet.send( msg, idz )
- id, message = rednet.receive()
- until id == msg
- return message
- end
- while true do
- local screenData = textutils.unserialize( getFrom( currentID, "getText" ) )
- term.setBackgroundColour( screenData["clearColor"] )
- term.clear()
- for i=1,#screenData-1 do
- term.setBackgroundColour( screenData[i]["bg"] )
- term.setTextColour( screenData[i]["cl"] )
- term.setCursorPos( screenData[i]["x"], screenData[i]["y"] )
- write( screenData[i]["text"] )
- end
- term.setTextColour( colors.red )
- term.setCursorPos(1,y-1)
- lWrite("+-")
- term.setCursorPos(1,y)
- lWrite("| ")
- term.setTextColour( colors.green )
- lWrite("^")
- term.setCursorBlink( textutils.unserialize( getFrom( currentID, "getBlink" ) ) )
- term.setTextColour( textutils.unserialize( getFrom( currentID, "getColor" ) ) )
- term.setBackgroundColour( textutils.unserialize( getFrom( currentID, "getBGColor" ) ) )
- term.setCursorPos( textutils.unserialize( getFrom( currentID, "getX" ) ), textutils.unserialize( getFrom( currentID, "getY" ) ) )
- end
Advertisement
Add Comment
Please, Sign In to add comment