ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: Pechu317 on Sep 09, 2020, 03:32 PM

Title: Printing onto a monitor
Post by: Pechu317 on Sep 09, 2020, 03:32 PM
So i'm making a lottery, and I want a large monitor that says "You could win:" in the top left corner, and a number in the middle that can be changed easily. How would I program this?
Title: Printing onto a monitor
Post by: QuickMuffin8782 on Sep 09, 2020, 05:23 PM
Quote from: Pechu317 on Sep 09, 2020, 03:32 PMSo i'm making a lottery, and I want a large monitor that says "You could win:" in the top left corner, and a number in the middle that can be changed easily. How would I program this?
Here's some code you could use, first you would need to wrap the peripheral:
local mon = peripheral.wrap(<side>)Then you can use the monitor like you would on a program using the normal apis installed to the computer built in like:
mon.print("You could win:") -- Use any function, but starting with the variable you used to wrap the monitor to work it out on the monitor to display.After that, printing on a monitor should be easy as a snap!
Title: Printing onto a monitor
Post by: Lupus590 on Sep 09, 2020, 09:18 PM
Quote from: QuickMuffin8782 on Sep 09, 2020, 05:23 PMmon.print("You could win:")
If I remember correctly, monitors don't have a print function as a peripheral, you would have to either write your own function for that or redirect the terminal to the monitor and use its print.

Or you could move the cursor on the monitor so that the next write looks like it printed.