This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
pipa's profile picture

Help with printing text to a Monitor

Started by pipa, 04 February 2013 - 04:36 AM
pipa #1
Posted 04 February 2013 - 05:36 AM
Hi currently trying to do a item sorter and i am now stuck at a little ticker. I have read all the wikis, but i can not figure out why it won't print this simple text on a monitor.
Tried everything, but i can't get it to work. Hope you can help me. I took most of it out, but it still stops after the "first Row with Item Names "


function ticker()



m = peripheral.wrap("left")
m.clear()
m.setCursorBlink(false)
m.setTextScale(1)



local file = fs.open("views","r")
local data = file.readAll()
file.close()
view = textutils.unserialize(data)


-- Row with Item Name
m.setCursorPos(3,2)
m.write("Cobblestone")
m.setCursorPos(3,4)
m.write("Dirt")

-- Row with Item amount
m.setCursorPos(18,2)
m.write(view[1])
m.setCursorPos(18,4)
m.write(view[2])


-- 2nd Row with Item Name
m.setCursorPos(40,2)
m.write("Cobblestone")
m.setCursorPos(40,4)
m.write("Dirt")


-- 2nd Row with Item amount
m.setCursorPos(55,2)
m.write(view[1])
m.setCursorPos(55,4)
m.write(view[2])


end

king77 #2
Posted 04 February 2013 - 05:43 AM
Have you tried using right instead of left?
pipa #3
Posted 04 February 2013 - 05:45 AM
The monitor is outputting at least two lines, so i must ve gotten the wrap side correctly. It just stops after printing:

Cobblestone

Dirt
king77 #4
Posted 04 February 2013 - 05:51 AM
How big is the monitor, are you writing off the screen?
pipa #5
Posted 04 February 2013 - 05:53 AM
Monitor is 7 advanced monitors wide and 4 high. Resolution is about 72*27, sorry if i missed to give that information.

Also the table "view" has information in it, which i can view fine by just typing print(view[1]).
king77 #6
Posted 04 February 2013 - 06:07 AM
There is something wrong with how you are loading the file or what is in the file but i don't know much about file loading so i can't help there.
Kingdaro #7
Posted 04 February 2013 - 06:29 AM
I just tried it with a fake set of data and it worked fine for me.
pipa #8
Posted 04 February 2013 - 06:35 AM
This is worrying, because i just took out the table and replaced it with a simpe "test" string and it still didn't work.

I have a little paint program that does drawPixel on a mouseclick event which works fine, so i can communicate with the monitor.

Txs for the help guys.
ChunLing #9
Posted 04 February 2013 - 11:16 PM
Have you got this working? If not, then you should post your current test code.

I would recommend starting by just replacing:
local file = fs.open("views","r")
local data = file.readAll()
file.close()
view = textutils.unserialize(data)
with

view = {"table string 1","table string 2",}
pipa #10
Posted 08 February 2013 - 12:03 PM
Yeah, i redownloaded the whole feed the beast client(force update) which seemed to fix my problem. Finished my project aswell, so thanks for the help.

[media]http://www.youtube.com/watch?v=NL2brFEHfBk[/media]
ChunLing #11
Posted 08 February 2013 - 12:14 PM
Hah, looks nice.