Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local portals = {
- [1] = {owner="HUB(X)"; id=137},
- [2] = {owner="JG"; id=147},
- [3] = {owner="Erwin"; id=138},
- [4] = {owner="maze farm"; id=0}
- }
- function showPortals()
- send("clearButtons")
- ix = 1
- for i=1,#portals do
- if i % 2 ~= 0 then
- send ("addButton 1 ".. ix .. " false 4 p:".. portals[i].owner)
- print (i .. " @ 1 " .. ix)
- else
- send ("addButton m ".. ix .." false 4 p:" .. portals[i].owner)
- print (i .. " @ 9 " .. ix)
- ix = ix + 2
- end
- end
- send("printButtons")
- end
- function openPortals(p2owner)
- pid = getPortal(p2owner)
- if pid == 0 or pid == 1 then
- print ("Portal " .. p2owner .. " ex. nicht!")
- return
- end
- print ("opening @ " .. p2owner )
- p = portals[pid]
- send("setCursorPos 4 m")
- send("write <Portal>")
- print ("freezing b/c a portal is beeing created! ")
- print (p.id)
- sa = rednet.send(portals[1].id, "OPEN")
- sb = rednet.send(p.id, "OPEN")
- sleep(4)
- sa = rednet.send(portals[1].id, "CLOSE")
- sb = rednet.send(p.id, "CLOSE")
- send ("clearLine")
- end
- function getPortal(owner)
- for i=1,#portals do
- if portals[i].owner == owner then
- return i
- end
- end
- return 0
- end
- function getPortalbyID(id)
- for i=1, #portals do
- if portals[i].id == id then
- return portals[i]
- end
- end
- return nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement