This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AnDwHaT5's profile picture

I need help making a wired modem send signals to multiple mon

Started by AnDwHaT5, 22 March 2013 - 10:35 AM
AnDwHaT5 #1
Posted 22 March 2013 - 11:35 AM
Its in the name i want to add more then one monitor to my program. I tryed
hi = { 1, 2, 3, 4 }
local mon = peripheral.wrap("monitor_" ..hi)

but it didnt work. I could use some help btw what i am doing is a huge powerpoint presentation and i need mon.write all over so i need it on more then one mon.
Engineer #2
Posted 22 March 2013 - 11:50 AM
Try this (untested):

local tWrap = { peripheral.wrap('right'),  peripheral.wrap('left'), --etc.. 
}

for i = 1, #tWrap do
  mon = tWrap[i]
  mon.write('hi')
end
AnDwHaT5 #3
Posted 22 March 2013 - 11:51 AM
yes but i have 4 monitors which are 1,2,3, and 4 in there wired modem how will that help?
AnDwHaT5 #4
Posted 22 March 2013 - 11:54 AM
ahh let me be more specific in one cable
AnDwHaT5 #5
Posted 22 March 2013 - 12:02 PM
I figured it out i used and and added more them one together i will make a tutorial.
Engineer #6
Posted 22 March 2013 - 12:03 PM
I figured it out i used and and added more them one together i will make a tutorial.
Or you can show the current code, im wondering now ^^
Kingdaro #7
Posted 22 March 2013 - 12:21 PM
To get and write to multiple monitors through a modem, it's usually best to use modem.getNamesRemote.


local modem = peripheral.wrap('back') -- wrap whichever modem on your computer is connecting your monitors
local names = modem.getNamesRemote()

for i=1, #names do
  local mon = peripheral.wrap(names[i])

  -- your drawing operations
end

And I'll go ahead and point to the NetGroup API I have linked in my signature, that'll probably help you out a bit if you don't feel like looping through the peripherals yourself.