Posted 08 December 2012 - 07:27 PM
hello all I am trying to make a program to function as a message board in game for me and some friends on a server. I wanted to make a program that basically asks for a name and a message and that would be diaplyed on a monitor (3x3 currently).
I am also saving the messages/poster in a log so that I can possibly add redstone buttons to scroll through previous messages.
The issue I have is that I cannot make the text wrap around the edge of the monitor. I tried a few things but they never seemed to work. also could not find any code that wraped things for monitor.
Below is my code:
Any help would be appreciated!
I eventually want to make this a rednet system with multiple boards!
I am also saving the messages/poster in a log so that I can possibly add redstone buttons to scroll through previous messages.
The issue I have is that I cannot make the text wrap around the edge of the monitor. I tried a few things but they never seemed to work. also could not find any code that wraped things for monitor.
Below is my code:
Spoiler
shell.run('clear')
UserLog ={}
MsgLog ={}
local lognum = 1
---------------
print('computer ID = '..os.getComputerID())
local Screen1 = peripheral.wrap('left')
Screen1.setTextScale(1)
local Sx, Sy = Screen1.getSize()
print('Screen Size = '..Sx..' '..Sy)
Screen1.clear()
Screen1.setCursorPos(1, 1)
Screen1.write('- Message Board ------------')
Screen1.setCursorPos(1, 2)
Screen1.write('-----------------------------')
while true do
shell.run('clear')
print('---------------------------------')
print('--- Message Board Application ---')
print('---------------------------------')
print('Press M to leave a message')
local event, param1 = os.pullEvent ("char")
if param1 == "m" then -- if the returned value was 'e'
---------Ask for Id and message
print('Who is leaving the message?')
local UserID = read()
print('What is your message?')
local Message= read()
table.insert(UserLog, lognum, UserID)
table.insert(MsgLog, lognum, Message)
else
shell.run('clear')
print ("Wrong button!")
sleep (1.5)
end
if UserLog[lognum] and MsgLog[lognum] ~= nil then
Screen1.clear()
Screen1.setCursorPos(1, 1)
Screen1.write('- Message Board ------------')
Screen1.setCursorPos(1, 2)
Screen1.write('-----------------------------')
Screen1.setCursorPos(1, 4 )
Screen1.write('-- Posted by '..UserLog[lognum])
Screen1.setCursorPos(1, 5 )
Screen1.write(' '..MsgLog[lognum])
shell.run('clear')
print('Message Left!')
lognum = lognum + 1
sleep(2)
end
end
I eventually want to make this a rednet system with multiple boards!