Posted 15 December 2014 - 11:02 AM
Just a quick program I wrote to make a touch screen dialing device for enhanced portals 3 dialing devices.
Plug and play, will automatically workout which sides the portal and monitor are on.
Reboot computer after adding new entry to the dialing device. Sorry no nice terminal interface.
Code
Set up example

Plug and play, will automatically workout which sides the portal and monitor are on.
Reboot computer after adding new entry to the dialing device. Sorry no nice terminal interface.
Code
Spoiler
sides = {'back','front','top','bottom','left','right'}
dhd = false
monitor = false
locations = {}
function dialLocation(i)
print(dhd.getStoredName(2))
outputLocations(locations[i])
dhd.terminate()
dhd.dialStored(i - 1)
end
function generateLocations()
for i=0, address_count - 1 do
locations[i + 1] = dhd.getStoredName(i)
end
end
function outputLocations(dialled)
monitor.clear()
term.clear()
monitor.setCursorPos(1,1)
term.setCursorPos(1,1)
for i,v in ipairs(locations) do
monitor.write(i..". "..v)
monitor.setCursorPos(1, i + 1)
term.setCursorPos(1, i)
term.write(i..". "..v)
end
if( dialled ~= false ) then
monitor.write("Dialled: "..dialled)
end
end
-- wrap peripherals automagically
for i, side in ipairs(sides) do
if(peripheral.isPresent(side)) then
if(peripheral.getType(side) == 'ep_dialling_device') then
dhd = peripheral.wrap(side)
elseif(peripheral.getType(side) == 'monitor') then
monitor = peripheral.wrap(side)
end
end
end
if(not dhd or not monitor) then
error('No portal or monitor connected to computer')
end
address_count = dhd.getStoredCount()
generateLocations()
outputLocations(false)
--event capture loop for mointor
while true do
event, side, xPos, yPos = os.pullEvent("monitor_touch")
--if address touched
if(yPos <= address_count) then
dialLocation(yPos)
end
end
Set up example
Spoiler

Edited on 15 December 2014 - 10:03 AM