Jump to content




Startup - Can't Access Monitors


  • You cannot reply to this topic
7 replies to this topic

#1 Beatsleigher

  • Members
  • 37 posts
  • LocationGermany, Osnabrueck

Posted 27 July 2013 - 09: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 :)

#2 ZagKalidor

  • Members
  • 111 posts

Posted 27 July 2013 - 10: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")

#3 Beatsleigher

  • Members
  • 37 posts
  • LocationGermany, Osnabrueck

Posted 27 July 2013 - 10:17 AM

View PostZagKalidor, on 27 July 2013 - 10:10 AM, said:

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.

#4 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 27 July 2013 - 10: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.

#5 ZagKalidor

  • Members
  • 111 posts

Posted 27 July 2013 - 10: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

#6 Beatsleigher

  • Members
  • 37 posts
  • LocationGermany, Osnabrueck

Posted 27 July 2013 - 11:28 AM

View PostZagKalidor, on 27 July 2013 - 10:56 AM, said:

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.

#7 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 27 July 2013 - 11:33 AM

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")


#8 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 27 July 2013 - 07: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

Example usage
mPrint(1,1,"Hello, This is the left monitor","left")
mPrint(1,1,"And this is the right side ;)/>","right")






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users