local bottomsave = 25
local w,h = term.getSize()
local savepoint = bottomsave -(h - 2)
local side = {"top","bottom","left","right","front","back"}
local onSides = {}
local contacts = true
local conFolder = "contacts"
local conLs = {}
file = io.open( conFolder, "r" )
local fileCont = file:read()
while fileCont do
a,b = fileCont:find( "/-/" )
conLs[ string.sub( fileCont,1,a-1 ) ] = string.sub(fileCont,b +1,#fileCont)
end
file:close()
for i=1,6 do
if peripheral.getType( side[i] ) == "modem" then
rednet.open( side[i] )
table.insert( onSides, side[i] )
end
end
term.clear()
rednet.broadcast( "Is now online" )
local line = {}
line[bottomsave-2] = "IMC+ bata 1.4 for CraftOS"
line[bottomsave-1] = "Type /clear to clear all text"
line[bottomsave] = "Type /quit to stop IM Pro"
term.setCursorPos( 1,2 )
local function lineMove()
for n = 1,bottomsave do
line[n] = line[n+1]
end
end
local function getName( getID )
end
local function lineUpdate()
for i = 1,h -2 do
term.setCursorPos( 1,i+1 )
term.setBackgroundColor( colors.green )
term.setTextColor( colors.black )
term.clearLine()
print( line[i+savepoint] )
end
term.setCursorPos( 1,1 )
term.setBackgroundColor( colors.lightGray )
term.setTextColor( colors.black )
io.write( string.rep( " ",w ) )
term.setCursorPos( 1,1 )
io.write( "you are:"..os.computerID() )
end
lineUpdate()
function messageSend()
while true do
local Update_Bypass = 1
term.setCursorPos( 1,h )
term.setBackgroundColor( colors.lightGray )
term.setTextColor( colors.black )
term.clearLine()
write( "> " )
local input = io.read()
if input == "/quit" then
term.setBackgroundColor( colors.black )
term.setTextColor( colors.white )
term.clear()
term.setCursorPos( 1,1 )
rednet.broadcast( "Is now offline" )
for i=1,#onSides do
rednet.close( onSides[i] )
end
break
elseif input == "/clear" then
Update_Bypass = 0
for i = 1, bottomsave do
line[i] = " "
end
lineUpdate()
end
if Update_Bypass == 1 then
lineMove()
line[bottomsave] = "YOU:"..input
lineUpdate()
term.setCursorPos( 1,2 )
lineUpdate()
rednet.broadcast( input )
term.setCursorPos( 1,h )
end
end
end
function messageReceive()
while true do
local id,ms = rednet.receive()
if id ~= os.computerID() then
lineMove()
line[bottomsave] = id..":"..ms
term.setCursorPos( 1,2 )
lineUpdate()
term.setCursorPos( 3,h )
end
end
end
function scrollsaved()
while true do
youDontNeedThis, key = os.pullEvent( "key" )
if key == 200 then
savepoint = savepoint -1
if savepoint <= -1 then savepoint = 0 end
elseif key == 208 then
savepoint = savepoint +1
if savepoint >= bottomsave -( h -2 ) + 1 then savepoint = bottomsave -(h -2) end
end
lineUpdate()
end
end
parallel.waitForAny( messageReceive,messageSend,scrollsaved )
thanks for the help