I'd write it myself if I could but I can barely remember how I made my password doors.
Any help would be greatly appreciated. The monitor size is five across and four high if that matters.
--#Finding monitor
local mon
for k, v in pairs( peripheral.getNames() ) do
if peripheral.getType( v ) == "monitor" then
mon = peripheral.wrap( v )
break
end
end
--#Error if no monitor is available
if not mon then
error( "No monitors connected!", 0 )
end
--#Get their input
write( "Name: " )
local name = read()
write( "Title: " )
local title = read()
--#Put it on the monitor
mon.setCursorPos( 1, 1 )
mon.write( "Name: " .. name )
mon.setCursorPos( 1, 2 )
mon.write( "Title: " .. title )
--#Finding monitor local mon for k, v in pairs( peripheral.getNames() ) do if peripheral.getType( v ) == "monitor" then mon = peripheral.wrap( v ) break end end --#Error if no monitor is available if not mon then error( "No monitors connected!", 0 ) end --#Get their input write( "Name: " ) local name = read() write( "Title: " ) local title = read() --#Put it on the monitor mon.setCursorPos( 1, 1 ) mon.write( "Name: " .. name ) mon.setCursorPos( 1, 2 ) mon.write( "Title: " .. title )
<snip>
You should get mon with peripheral.find("monitor") instead of that.
if not peripheral.find then
function peripheral.find()
--code
end
end
for k,v in pairs(rs.getSides()) do
if peripheral.isPresent(v) then
-- do something here
end
end
function getFirstPeripheral(mask)
local func = peripheral.getNames or rs.getSides
if peripheral.find then
return (peripheral.find(mask))
end
for _, side in pairs(func()) do
if peripheral.getType(side) == mask then
return peripheral.wrap(side)
end
end
end
--#Finding monitor (Yes I could do it differently but I'm doing it this way..)
local mon
for k, v in pairs( peripheral.getNames() ) do
if peripheral.getType( v ) == "monitor" then
mon = peripheral.wrap( v )
break
end
end
--#Error if no monitor is available
if not mon then
error( "No monitors connected!", 0 )
end
local players = {}
while true do
--#Get their input
write( "Name: " )
local name = read()
write( "Title: " )
local title = read()
players[ #players + 1 ] = {name = name, title = title}
--#Put it on the monitor
mon.clear()
for i = 1, #players do
mon.setCursorPos( 1, i * 2 -1 )
mon.write( "Name: " .. players[ i ].name )
mon.setCursorPos( 1, i * 2 )
mon.write( "Title: " .. players[ i ].title )
end
end