Update sms.lua
This commit is contained in:
parent
7e567c518c
commit
fb443d3a03
1 changed files with 14 additions and 5 deletions
|
@ -81,9 +81,9 @@ local mx,my = displayWin.getSize()
|
||||||
local function readMsg()
|
local function readMsg()
|
||||||
term.redirect(readWin)
|
term.redirect(readWin)
|
||||||
while true do
|
while true do
|
||||||
term.setCursorBlink(true)
|
term.setCursorBlink(true)
|
||||||
term.setBackgroundColor(colors.green)
|
term.setBackgroundColor(colors.green)
|
||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1,1)
|
term.setCursorPos(1,1)
|
||||||
term.write("Send: ")
|
term.write("Send: ")
|
||||||
|
@ -110,7 +110,7 @@ local function readMsg()
|
||||||
elseif e[1] == "http_success" then
|
elseif e[1] == "http_success" then
|
||||||
displayWin.setCursorPos(1,y)
|
displayWin.setCursorPos(1,y)
|
||||||
displayWin.write("<You> "..base64.decode(msg))
|
displayWin.write("<You> "..base64.decode(msg))
|
||||||
if y == my then displayWin.scroll(1) else y = y +1 end
|
if y == my then displayWin.scroll(1) else if #msg < 20 then y = y + 1 else y = y + 2 end end
|
||||||
break
|
break
|
||||||
elseif e[1] == "http_failure" then
|
elseif e[1] == "http_failure" then
|
||||||
term.redirect(ntv)
|
term.redirect(ntv)
|
||||||
|
@ -128,13 +128,22 @@ local function recMsg()
|
||||||
displayWin.setTextColor(colors.black)
|
displayWin.setTextColor(colors.black)
|
||||||
displayWin.clear()
|
displayWin.clear()
|
||||||
local function printMsg(msg)
|
local function printMsg(msg)
|
||||||
|
local
|
||||||
displayWin.setCursorBlink(false)
|
displayWin.setCursorBlink(false)
|
||||||
displayWin.setCursorPos(1,y)
|
displayWin.setCursorPos(1,y)
|
||||||
local nTerm = term.current()
|
local nTerm = term.current()
|
||||||
term.redirect(displayWin)
|
term.redirect(displayWin)
|
||||||
print(msg)
|
print(msg)
|
||||||
term.redirect(nTerm)
|
term.redirect(nTerm)
|
||||||
if y == my then displayWin.scroll(1) else y = y + 1 end
|
if y == my then
|
||||||
|
displayWin.scroll(1)
|
||||||
|
else
|
||||||
|
if #msg < 26 then
|
||||||
|
y = y + 1
|
||||||
|
else
|
||||||
|
y = y + 2
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
printMsg("Type /logout to exit")
|
printMsg("Type /logout to exit")
|
||||||
while true do
|
while true do
|
||||||
|
|
Loading…
Reference in a new issue