Jump to content




Enhanced Portals 3 Dialer help


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

#1 X5452

  • New Members
  • 2 posts

Posted 11 March 2014 - 04:57 AM

Hi All.

Im trying to use a computer to control a Enhanced Portals Dialer as seen here. Using the code provided here. http://pastebin.com/AGu2J1Q7

dial = peripheral.wrap("right")
monitor = peripheral.wrap("top")
controller = peripheral.wrap("Portal Controller_0")
portalActive = false
locationCount = 0

function update()
  portalActive = controller.isPortalActive()
  locationCount = dial.getStoredCount()
end

function drawScreen()
  if portalActive then
    monitor.setBackgroundColor(colors.green)
    monitor.clear()
    monW, monH = monitor.getSize()
    monitor.setCursorPos(monW / 2 - string.len("Terminate") / 2, monH / 2)
    monitor.write("Terminate")
  else
    monitor.setBackgroundColor(colors.black) 
    monitor.clear()

    if (locationCount - 1 > 0) then
	  for i = 1, locationCount do
	    monitor.setCursorPos(1, i)
	
	    if (i % 2 == 0) then
		  monitor.setBackgroundColor(colors.gray)
	    else
		  monitor.setBackgroundColor(colors.lightGray)
	    end
  
	    name = dial.getStoredName(i - 1)
	    monW, monH = monitor.getSize()
	
	    monitor.write(name)	 
	    k = string.len(name)
	
	    while (k < monW) do
		  monitor.write(" ")
		  k = k + 1
	    end
	
	  end
    else
	  monitor.setCursorPos(1, 1)
	  monitor.write("No Entries")
    end
  end
end

function handleInput()
  event, side, posX, posY = os.pullEvent("monitor_touch")

  if portalActive then
    dial.terminate()
  else
    if (posY <= locationCount) then
	  dial.dialStored(posY - 1)
    end
  end
end

while true do
  update()
  drawScreen()
  handleInput()
end


Attempting to run the program gives me the following error:

startup:8:Attempt to index ? (a nil value)

I'm assuming this indicates an error on line 8. But I don't know enough to determine what the issue might be. Any help is greatly appreciated.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 March 2014 - 04:59 AM

What was the peripheral name of the portal controller when you activated the wired modem that you attached to it? It would have mentioned it in chat.

#3 X5452

  • New Members
  • 2 posts

Posted 11 March 2014 - 06:45 AM

View PostLyqyd, on 11 March 2014 - 04:59 AM, said:

What was the peripheral name of the portal controller when you activated the wired modem that you attached to it? It would have mentioned it in chat.

Dialing Device_4

Thanks for helping!

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 March 2014 - 02:25 PM

So, the third line should be changed to use that name instead of Portal Controller_0, in case you didn't know.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users