Jump to content




I cant use Peripheral.wrap. ...



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

#1 kruschen

  • Members
  • 4 posts

Posted 07 July 2016 - 03:40 PM

I cant use it.

And I need a Programm for Big Reactors to show the Reactor stats

Posted Image

Posted Image

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 07 July 2016 - 04:12 PM

Moved to Ask a Pro.

There isn't a print method on a monitor peripheral.

#3 ReBraLaCC

  • Members
  • 100 posts
  • LocationSublime Text 2

Posted 07 July 2016 - 07:00 PM

need to define it and then do <def>.write(text)

<def> is the definition you gave it

would suggest looking at this http://computercraft.info/wiki/Monitor

#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 07 July 2016 - 11:40 PM

When you "connected" the monitor by right-clicking the wired modem, you were given a "network name" (likely "monitor_0" or somesuch). That is the name you should be using when wrapping; in this case, "back" ends up wrapping the wired modem connected to the back of the computer.

Though as Lyqyd points out, either way you won't get a "print" function. Refer to the link ReBraLaCC gave you, the term API, and perhaps term.redirect() in particular.

#5 The Crazy Phoenix

  • Members
  • 136 posts
  • LocationProbably within 2 metres of my laptop.

Posted 08 July 2016 - 08:31 AM

If you're going to use term.redirect, I suggest you store a copy of term.current before hand and then redirect to that copy once your program is finished.

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 08 July 2016 - 01:34 PM

The usual idiom for redirecting a terminal is as follows:

local _oldTerm = term.redirect(mon)

--# redirected drawing code

if _oldTerm then
  term.redirect(_oldTerm)
else
  term.restore()
end


#7 kruschen

  • Members
  • 4 posts

Posted 09 July 2016 - 09:26 AM

Thanks for all the awnsers i try it monday :)

#8 kruschen

  • Members
  • 4 posts

Posted 09 July 2016 - 07:33 PM

You awnsers helped a lot

but i have a error:

Posted Image

the script works well

but if i will clear the monitor then it gave an error in line 6

Posted Image

#9 Anavrins

  • Members
  • 775 posts

Posted 09 July 2016 - 08:58 PM

kraftwerk.getActive is a function, call it using () at the end of it.
if kraftwerk.getActive() then...

Edit: Same thing for monitor.clear, should be monitor.clear()

Edited by Anavrins, 09 July 2016 - 08:59 PM.


#10 kruschen

  • Members
  • 4 posts

Posted 09 July 2016 - 09:41 PM

Thanks that helps a lot :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users