37 posts
Location
Germany, Osnabrueck
Posted 27 July 2013 - 10:52 AM
Hey guys!
I'm starting out to create a Minecraft map, using Tekkit 3.1.2, and at the beginning I'm using computers to show information and stuff to the user/s.
Now, I have the actual programs (If one can call simple print "<Text>" statements a program. Rofl) and they run, but I need them to be started at startup.
I have tried using
shell.run("monitor left monLeftWelcome")
but that doesn't want to work. I can use
shell.run("monitor")
but that is really of no use.
How can I access the monitors from the shell command?
Thanks!
P.S.: I program in Visual Basic and (Sort of) Java, so please excuse the n00biness :)/>
112 posts
Posted 27 July 2013 - 11:10 AM
Just rename your welcome programm - "startup"
Or do you mean to redirect your print commands onto the monitor?
Put this:
Thingthatwillshowthisall = peripheral.wrap("side the mon is on")
term.redirect(Thingthatwillshowthisall)
On top of your "program"
Maybe you will find a variable that is even greater than mine but the most people use the word "monitor" for it and newbies could think that this is command-like keyword but its just a variable. You may also would like to call it "dishwascher" which is a very matching word.
You better use a single computer with 2 monitors left and right. You wrapp em like:
Monleft = perpheral.wrap("left")
Monright = peripheral.wrap("right")
term.redirect(Monleft)
Term.redirect(Monright)
And then you call your printcommands as follows:
Monright.write("bla bla")
Monleft.write ("even more blas")
37 posts
Location
Germany, Osnabrueck
Posted 27 July 2013 - 11:17 AM
Just rename your welcome programm - "startup"
Or do you mean to redirect your print commands onto the monitor?
Thingthatwillshowthisall = peripheral.wrap("side the mon is on")
term.redirect(Thingthatwillshowthisall)
Maybe you will find a variable that is even greater than mine but the most people use the word "monitor" for it and newbies could think that this is command-like keyword but its just a variable. You may also would like to call it "dishwascher" which is a very matching word.
No, there are two monitors, both of which need seperate programs.
For example:
The left monitor runs monLeftWelcome
The right monitor, however, runs monRightWelcome1 (There are four programs to be run on the right monitor)
That's why I want to run the programs at startup on the corresponding monitors.
1688 posts
Location
'MURICA
Posted 27 July 2013 - 11:31 AM
The monitor program uses a term.redirect(), and when ran simeotaneously (using a parallel, for example), it would just redirect both programs to the second monitor. You would need to write a single program to display your information on both monitors.
112 posts
Posted 27 July 2013 - 11:56 AM
Use
Shell.run("program")
Make a little menue with maybe push 1 to start prog 1, push 2 to start prog 2
And rewrite the content, shown at each side with the left-right thing i mentioned above
37 posts
Location
Germany, Osnabrueck
Posted 27 July 2013 - 12:28 PM
Use
Shell.run("program")
Make a little menue with maybe push 1 to start prog 1, push 2 to start prog 2
And rewrite the content, shown at each side with the left-right thing i mentioned above
Wouldn't this work (Like it does with redpulse):
shell.run("monitor", "left", "monLeftWelcome")
I'm asking this, because they're just command line arguments, I guess.
758 posts
Location
Budapest, Hungary
Posted 27 July 2013 - 12:33 PM
That'd still mess up the the left monitor, since the other program would print its things on that as well. Replace every occurence of "term" with "monitor" in both programs, then put this piece of code at the top of them:
local monitor = peripheral.wrap("corresponding_monitor_side_here")
1852 posts
Location
Sweden
Posted 27 July 2013 - 08:19 PM
Would this help? .-.
m = peripheral.wrap("left")
mon = peripheral.wrap("right")
local function mPrint(x,y,text,side)
if side == "left" then
m.setCursorPos(x,y)
m.write(text)
elseif side == "right" then
mon.setCursorPos(x,y)
mon.write(text)
end
end
Or this
Spoiler
local function mPrint(x,y,text,side)
m = peripheral.wrap(side)
m.setCursorPos(x,y)
m.write(text)
end
Example usage
mPrint(1,1,"Hello, This is the left monitor","left")
mPrint(1,1,"And this is the right side ;)/>","right")