Jump to content




Run monitor and pc at same time


24 replies to this topic

#1 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 March 2012 - 08:33 AM

Ever wanted to be using your monitor and your pc at the same time? This program does that.

(thanks to
Coryf88

)
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(:o/>/> invoke("setCursorBlink", :o/>/> end
term.clear = function() invoke("clear") end
term.clearLine = function() invoke("clearLine") end

nativeTerm.clear()
nativeTerm.setCursorPos(1, 1)
print(os.version())

If you put a monitor on the right and run this program, you can use the monitor and see it on your computer screen.

#2 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 26 March 2012 - 05:06 PM

Does this even start programs that have to be started with parameters/arguments?

#3 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 March 2012 - 07:22 PM

View PostWolvan, on 26 March 2012 - 05:06 PM, said:

Does this even start programs that have to be started with parameters/arguments?

Not yet...

#4 BlackRa1n

  • New Members
  • 69 posts

Posted 26 March 2012 - 08:13 PM

Awesome! Now I can have hundereds of people gather around a giant monitor to watch me play snake and still play it because the terminal will also be running it!

#5 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 March 2012 - 08:15 PM

View PostBlackRa1n, on 26 March 2012 - 08:13 PM, said:

Awesome! Now I can have hundereds of people gather around a giant monitor to watch me play snake and still play it because the terminal will also be running it!

I haven't tested that but if something happens, please tell me

#6 BlackRa1n

  • New Members
  • 69 posts

Posted 26 March 2012 - 08:35 PM

Nope, it displays on Monitor first, and after that program ends on monitor, it shows up on terminal/computer!

#7 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 March 2012 - 08:39 PM

View PostBlackRa1n, on 26 March 2012 - 08:35 PM, said:

Nope, it displays on Monitor first, and after that program ends on monitor, it shows up on terminal/computer!

Aww, I'm gonna fix that but in the next fix, it might require 2 computers (1 to handle the terminal and the other to handle the monitor)

#8 BlackRa1n

  • New Members
  • 69 posts

Posted 26 March 2012 - 08:44 PM

And once it terminates on the monitor, the input for the game I was playing (MineDwarf, on RedWorksOS) lagged alot!

#9 Resistance128

  • New Members
  • 9 posts

Posted 27 March 2012 - 10:03 PM

Sorry for asking, but how do you make a monitor.?
Ps: I seem to have managed to break the underline button, It wouldn't stop until I fixed a spelling error ._.

#10 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 27 March 2012 - 10:10 PM

hey what about this: try using tomiss' strutils API to seperate commands wit spaces, in program and parameters. and then you should be able to create a program that can run programs with arguments

#11 Alex_

  • Members
  • 63 posts
  • LocationPontefract, West Yorkshire, England

Posted 29 March 2012 - 05:13 PM

you should put it to startup and also have the person on startup type which side is the monitor eg
print("which side is your monitor")
monitorside = read()
monitor = peripheral.wrap(monitorside)
Just a suggestion nothing else

#12 Coryf88

  • Members
  • 1 posts

Posted 01 April 2012 - 03:59 AM

Put the following into your terminal's "startup" or run it as a program.

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(:o/>/> invoke("setCursorBlink", :o/>/> end
term.clear = function() invoke("clear") end
term.clearLine = function() invoke("clearLine") end

nativeTerm.clear()
nativeTerm.setCursorPos(1, 1)
print(os.version())


#13 Ivan Uginhigher

  • New Members
  • 3 posts

Posted 03 April 2012 - 12:37 AM

a tuturial on how to connect to tv network computer in minecraft will be a great idea
also the fact a code for each tv channels and dont forget a memory bank which radomize shows

#14 Noodle

  • Members
  • 989 posts
  • LocationSometime.

Posted 03 April 2012 - 02:18 AM

It only loads the monitor once.
You could go into your mods/computercraft folder and add the code to start every thing like hello, snake, etc.
That would be annoying.
Another thing @BlackRa1n
The monitor has a snippet of code with parameters
monitor <side> <application> <forgot this one>

#15 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 08 April 2012 - 01:45 AM

Thanks Corfy88, i updated the post

#16 ZeePal

  • Members
  • 12 posts

Posted 01 June 2012 - 07:09 AM

Hey ComputerCraftFan11,

I like this script and I thought I would tweak it a bit as well as thank you:

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

local tArgs = { ... }
if #tArgs > 1 then
 print( "Usage: dual_monitors [-d|--disable]" )
 return
end

if tArgs[1] == "-d" or tArgs[1] == "--disable" then
 os.unloadAPI("/rom/apis/term")
 os.loadAPI("/rom/apis/term")
 term.clear()
 term.setCursorPos(1, 1)
 print(os.version())
else
 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", :P/>/> end
 term.clear = function() invoke("clear") end
 term.clearLine = function() invoke("clearLine") end

 term.clear()
 term.setCursorPos(1, 1)
 print(os.version())
end

You can turn it off and on and while its on programs will just write to both (unless they access the term api directly).

I tested it on snake :)/>

#17 Kikanek

  • New Members
  • 2 posts

Posted 09 June 2012 - 05:24 AM

View PostNoodle, on 03 April 2012 - 02:18 AM, said:

It only loads the monitor once.
You could go into your mods/computercraft folder and add the code to start every thing like hello, snake, etc.
That would be annoying.
Another thing @BlackRa1n
The monitor has a snippet of code with parameters
monitor <side> <application> <forgot this one>
You forgot one...
You just need to paste it to "shell" program ;)/>
Under the line "print( os.version )" or replacing it, it will work anyways...
And it will work always, on any OS, any program, any computer :D/>...
And it will just don't work, not make error on computers what don't have monitor :D/>
Sorry for bad English, i am from Poland... :)/>
Regards,
Czcibor Bohusz-Dobosz a.k.a Kikanek

#18 Po1son

  • New Members
  • 3 posts

Posted 28 June 2012 - 03:53 PM

I seem to have a problem, how could I fix this

Posted Image

#19 Kikanek

  • New Members
  • 2 posts

Posted 30 June 2012 - 11:37 AM

@UP:
Why are You posting this here?
It's topic about running monitor and computer(craft) at the same time, not program named "moncopy".
But, to it not be offtopic... Where You find the program? It could have bug in code.
As i can see... The error is in line 4.
Regards,
Czcibor Bohusz-Dobosz a.k.a Kikanek

#20 Uchiha Madara

  • New Members
  • 3 posts
  • LocationNorway

Posted 30 June 2012 - 10:01 PM

I think Po1son script is the monitor script. by looking at the name and the bit of code i see in the background (Name: Moncopy: Monitor Copy)
But I'm only guessing so don't hate me if I'm wrong...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users