Posted 27 January 2013 - 09:59 AM
This program displays your terminal to a monitor and allows you to still use the terminal. The problem is that it does not fill the monitor completely, it fills about a 3*5 screen, when I would like it to fill a 6*8 screen.
I'm new to this, please help.
I'm new to this, please help.
--[[
demo
by BigSHinyToys
]]--
local sides = {
[1] = "left",
[2] = "top",
[3] = "bottom",
[4] = "right",
[5] = "back",
[6] = "front",
}
local tArgs = {...}
local monSide
local monBig = false
local termX,termY = term.getSize()
local customTerm = {}
local moniter
local oldMon = {}
local attached = false
for i=1,6 do
if peripheral.getType(sides[i]) == "monitor" then
monSide = string.lower(sides[i])
if peripheral.isPresent(monSide) and peripheral.getType(monSide) == "monitor" then
attached = true
local monX,monY = peripheral.call(monSide,"getSize")
if monX >= termX and monY >= termY then
monBig = true
else
peripheral.call(monSide,"setTextScale",0.5)
monX,monY = peripheral.call(monSide,"getSize")
if monX >= termX and monY >= termY then
monBig = true
else
print("Monitor to small")
end
end
end
elseif #tArgs == 1 then
if string.lower(tArgs[1]) == "restore" then
term.restore()
end
end
end
if not attached then
print("No screen attatched")
end
local function wrap( _sFunction )
return function( ... )
if peripheral.isPresent(monSide) then
peripheral.call(monSide,_sFunction,...)
return oldMon[_sFunction](...)
else
term.restore()
print("Screen restored")
end
end
end
if monBig then
moniter = peripheral.wrap(monSide)
for k,v in pairs(term.native) do
oldMon[k] = v
end
for k,v in pairs( term.native ) do
if type( k ) == "string" and type( v ) == "function" then
customTerm[k] = wrap(k)
end
end
term.redirect(customTerm)
term.clear()
term.setCursorPos(1,1)
print("Running on monitor")
end