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

How to run a program on Computer + Monitor

Started by n1ghtk1n9, 10 August 2012 - 06:06 PM
n1ghtk1n9 #1
Posted 10 August 2012 - 08:06 PM
I made a program for my faction/friends on this Tekkit server that I play on, and often we mostly get on at different times, so I made a program called "writeanote". It asks you "To" (who to leave it for) "Msg" (What the message you want to leave is) and "From" (Obviously, who ever you are) Then after I type it, I was hoping somehow I could type the message on the computer, then Display the message on the Monitor. What I've tried to do is do "monitor top disk/writeanote" and It RUNS writeanote on the monitor, so I have to type in the computer, exit it, look at the monitor, type in the computer, exit it, look at the monitor, and keep doing that until I type the whole thing. How would I type the message into the comptuer, then when I'm done with it, display it on the top monitor.

Program : http://pastebin.com/CubDh6iH

Also, please add tweaks and such to it. I'm still learning, so your feedback + tweaks would really help!
Kolpa #2
Posted 10 August 2012 - 08:17 PM
somebody did an api for that lemme look for it …
Exerro #3
Posted 10 August 2012 - 11:24 PM
term.redirect(peripheral.wrap(side))
print(to)
print(msg)
print(from)
term.restore()
I think this is how you would do it…just put it at the end of your code
wonderdude #4
Posted 11 August 2012 - 02:06 AM
here is the code i use: just put this in a program and run the program you want displayed

local nativeTerm = term.native or term

local function invoke(sMethod, …)
nativeTerm[sMethod](…)
for k,sSide in pairs(redstone.getSides()) do
if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "monitor" then
peripheral.call(sSide, sMethod, …)
end
end
end

term.write = function(text) invoke("write", text) end
term.scroll = function(n) invoke("scroll", n) end
term.setCursorPos = function(x, y) invoke("setCursorPos", x, y) end
term.setCursorBlink = function( ;)/>/> invoke("setCursorBlink", :(/>/> end
term.clear = function() invoke("clear") end
term.clearLine = function() invoke("clearLine") end

nativeTerm.clear()
shell.run("startup") –or whatever your program is named


no idea how to remove the smileys so here is the pastebin: http://pastebin.com/hBXbrfTP
Kolpa #5
Posted 11 August 2012 - 02:30 PM
here is the code i use: just put this in a program and run the program you want displayed

local nativeTerm = term.native or term

local function invoke(sMethod, …)
nativeTerm[sMethod](…)
for k,sSide in pairs(redstone.getSides()) do
if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "monitor" then
peripheral.call(sSide, sMethod, …)
end
end
end

term.write = function(text) invoke("write", text) end
term.scroll = function(n) invoke("scroll", n) end
term.setCursorPos = function(x, y) invoke("setCursorPos", x, y) end
term.setCursorBlink = function( ;)/>/> invoke("setCursorBlink", :(/>/> end
term.clear = function() invoke("clear") end
term.clearLine = function() invoke("clearLine") end

nativeTerm.clear()
shell.run("startup") –or whatever your program is named


no idea how to remove the smileys so here is the pastebin: http://pastebin.com/hBXbrfTP
use the code tag

local nativeTerm = term.native or term
local function invoke(sMethod, ...)
nativeTerm[sMethod](...)
for k,sSide in pairs(redstone.getSides()) do
if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "monitor" then
peripheral.call(sSide, sMethod, ...)
end
end
end
term.write = function(text) invoke("write", text) end
term.scroll = function(n) invoke("scroll", n) end
term.setCursorPos = function(x, y) invoke("setCursorPos", x, y) end
term.setCursorBlink = function(  invoke("setCursorBlink",  end
term.clear = function() invoke("clear") end
term.clearLine = function() invoke("clearLine") end
nativeTerm.clear()
shell.run("startup") --or whatever your program is named