259 posts
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.
1522 posts
Location
The Netherlands
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
259 posts
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?
259 posts
Posted 22 March 2013 - 11:54 AM
ahh let me be more specific in one cable
259 posts
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.
1522 posts
Location
The Netherlands
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 ^^
1688 posts
Location
'MURICA
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.