Jump to content




Monitor program isn't giving arguments.


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

#1 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 04 February 2013 - 09:12 AM

So I wanted to make a nice rednet receiving program to run in the background and on my monitor, however it requires the use of arguments (so that I can just throw it on any computer and run it without changing the code) and when I try to use the monitor program to run it, the arguments aren't given. I'm thinking it's on my end, but I try it without using the monitor program and it works fine. I tried editing and painting with the monitor, and arguments weren't given there either.

Posted Image

Posted Image

How would I go about fixing this? Would I need to download another version of the program?

#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 04 February 2013 - 09:34 AM

Weird,,, according to the program in my FTB folder the usage is:
print( "Usage: monitor <side> <program> <arguments>" )

It states that <arguments> are allowed... but yours seems to only been accepting up to the second argument

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 February 2013 - 01:20 PM

its a bug in the code when the devs made it.

#4 GopherAtl

  • Members
  • 888 posts

Posted 05 February 2013 - 03:06 AM

You say you want to run it in the background, I'm guessing that means as a coroutine, with another shell running on the computer terminal? If so, this would not work as you expect anyway, as monitor simply redirects once before running the program, so any other coroutines running would also be redirected. My own coroutine API, goroutines, could do this, though; with the API loaded you could simply call goroutine.spawnWithRedirect, passing the wrapped monitor as the redirect and shell.run as the function, with your program and any arguments. Goroutines will handle switching redirect targets automatically, so you could run any number of programs on different monitors. I'm on my phone right now, so can't give proper sample code, but there is detailed documentation in my APIs thread and I'll be glad to help more later when I'm back at a computer.

</shamelessselfpromotion>

#5 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 05 February 2013 - 05:44 AM

I've already addressed that and fixed my program accordingly so it doesn't redirect the terminal. However I'd still like to be able to efficiently use the monitor program.

#6 GopherAtl

  • Members
  • 888 posts

Posted 05 February 2013 - 06:59 AM

then you'll just have to fix the monitor program. The problem is it passes the args to coroutine.create, rather than to coroutine.resume. You can get it to pass them on the first call to resume easily though, just change line 37 to
local event={...}

and voila! works.

#7 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 05 February 2013 - 07:32 AM

Awesome! Thanks.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users