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

printer.write (string value)

Started by minecrash, 06 November 2012 - 07:38 AM
minecrash #1
Posted 06 November 2012 - 08:38 AM
hello, when i try to make a printer print a string value does it always say it's nil even when the print api shows the tekst just fine.

so how can i make a printer print a string value?
PixelToast #2
Posted 06 November 2012 - 08:50 AM
the printer isnt an api, you have to wrap it first

local printer = peripheral.wrap("side")
now any printer functions work
e.g.

local printer = peripheral.wrap("right")
printer.write("ALL THE THINGS!")
Lyqyd #3
Posted 06 November 2012 - 08:51 AM
Please post the full code and the full error message.
minecrash #4
Posted 07 November 2012 - 05:47 AM
got it to work thanks to pixeltoats. now a different question, how can i make the computer count the amount of letters in a received rednet message?
Lyqyd #5
Posted 07 November 2012 - 06:37 AM

id, message = rednet.receive()
stringLength = string.len(message)
minecrash #6
Posted 09 November 2012 - 04:45 AM
thanks alot

some more questions i came up with (i never like to make about a billion topics for each question i have to ask).

how can i make the computer change a string value? example: the value is "this is a string value'' and the script edit it in such a way that each word is on a different line.

is there a way to turn a file into a string value? example: there is a file on the computer called ''text'' which contains text which then could be opened into a program to make the value "textfile" the text in the the file "text".
Lyqyd #7
Posted 09 November 2012 - 06:41 AM
Check out the tutorials section.
minecrash #8
Posted 09 November 2012 - 11:45 PM
i found how to make the script read/write files and how to enter a string on different lines.
but can't find how to edit a string value. what i want to do is make a script that automatically creates a new line every X amount of letters from a string value.