I am working on a multi-monitor input program and peripheral set. Each monitor should be able to perform the same task, and will display the same information. However, I am running into an issue where I can't get an os.eventPull out of any of my monitors.
What I Know
I am already under the impression that with a single monitor, if I want input(xPos and yPos) all I need to do is call those variables.
The Question
Is this the same thing for the multi-monitors? Or do I NEED to pull the event from specific "sides"(aka monitors on the network). They all do the same thing, a simple keypad, but for some reason I can't get a response out of any of them now.
Here is an example of what I've got:
function redNetSend()
local password = {r = 0, g = 0, b = 0}
local monOne = peripheral.wrap("monitor_0")
local monTwo = peripheral.wrap("monitor_1")
local monThree = peripheral.wrap("monitor_2")
local monFour = peripheral.wrap("monitor_3")
monOne.setTextScale(0.5)
monTwo.setTextScale(0.5)
monThree.setTextScale(0.5)
monFour.setTextScale(0.5)
while(true) do
monOne.clear()
monTwo.clear()
monThree.clear()
monFour.clear()
drawImage(monOne, ".background", 1, 1)
drawImage(monTwo, ".background", 1, 1)
drawImage(monThree, ".background", 1, 1)
drawImage(monFour, ".background", 1, 1)
drawText(monOne, "SUBMIT", 5, 8, colors.orange, colors.white)
drawText(monTwo, "SUBMIT", 5, 8, colors.orange, colors.white)
drawText(monThree, "SUBMIT", 5, 8, colors.orange, colors.white)
drawText(monFour, "SUBMIT", 5, 8, colors.orange, colors.white)
event, side, xPos, yPos = os.pullEvent("monitor_touch")
if(yPos >= 3 or yPos < 6 and xPos == 3 or xPos == 4) then
password["r"] = "1"
--FUNCTION HERE
elseif(yPos >= 3 or yPos < 6 and xPos == 7 or xPos == 8) then
password["g"] = "1"
--FUNCTION HERE
elseif(yPos >= 3 or yPos < 6 and xPos == 11 or xPos == 12) then
password["b"] = "1"
--FUNCTION HERE
elseif(yPos == 8 and xPos >= 5 or xPos < 11) then
drawText(monOne, "SUBMIT", 5, 8, colors.yellow, colors.white)
drawText(monTwo, "SUBMIT", 5, 8, colors.yellow, colors.white)
drawText(monThree, "SUBMIT", 5, 8, colors.yellow, colors.white)
drawText(monFour, "SUBMIT", 5, 8, colors.yellow, colors.white)
rednet.send(databaseServer, "id_door_topside::"..password[r]..password[g]..password[b])
local id, message, protocol = rednet.receive()
if(message == ".successful") then
redstone.setOutput(side, true)
os.sleep(10)
if(redstone.getOutput(side) == true) then
redstone.setOutput(side, false)
end
end
os.sleep(1)
--FUNCTION HERE
end
end
end
There is a lot more to the program, and the function is being called by the Parallel API. I'll include the remainder of the lua file in a link via pastebin, just encase the issue I am running into is somewhere else.
http://pastebin.com/xziyE8cW
Thank you in advance,
Donald R. Valverde (Cavious)