Posted 29 July 2012 - 07:39 PM
Hello gentleman,
i have following problem:
tried to figure out a way of displaying a text on monitor (monitor size is 6x5 blocks - in multiplayer)
found in this forum following:
Original topic http://www.computerc...age-on-monitor/
Apperenty this doenst work
How i try to use it: I open up the computer, type in: edit start, enter the sourcecode from above - i hit save. Then ill type in "Start" it tells me " start:20: attempt to index ? (a nil value)"
What iam doing wrong and how iam suppose to make the text appear in the monitor with multiple lines?
Also if possible i want the first line in a differnt Size than the rest and eveything needs to be center lined
thanks in advance
(just to mention ive tried this in singleplayer but ill need it to work in Multiplayer to display a certain text on the monitor)
i have following problem:
tried to figure out a way of displaying a text on monitor (monitor size is 6x5 blocks - in multiplayer)
found in this forum following:
local tText = {
"First line", – you can change the lines here
"Second line",
"Some more",
"lines here"
– and you can add more if you want, just don't forget to put the commas (,) at the end of the lines (except for the last one)
}
local sSide = "left"
local nTextSize = 1 – change the text size here (from 1 to 5)
local function printCenter(mon, t)
local w, h = mon.getSize()
local y = math.floor((h / 2) - (#t / 2)) - 1
for i, line in ipairs(t) do
local x = math.floor((w / 2) - (#line / 2))
mon.setCursorPos(x, y + i)
mon.write(line)
end
end
local mon = peripheral.wrap(sSide)
mon.setTextScale(nTextSize)
printCenter(mon, tText)
Original topic http://www.computerc...age-on-monitor/
Apperenty this doenst work
How i try to use it: I open up the computer, type in: edit start, enter the sourcecode from above - i hit save. Then ill type in "Start" it tells me " start:20: attempt to index ? (a nil value)"
What iam doing wrong and how iam suppose to make the text appear in the monitor with multiple lines?
Also if possible i want the first line in a differnt Size than the rest and eveything needs to be center lined
thanks in advance
(just to mention ive tried this in singleplayer but ill need it to work in Multiplayer to display a certain text on the monitor)