Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screen = "top";
- local stargate = "stargate_1";
- local address = {
- { name = " Andrelec ", adrs = "NKA5-KKC-XS", color = colors.red},
- { name = " Wetixx ", adrs = "FLR4-82S-XS", color = colors.cyan},
- { name = " Deep ", adrs = "9992-HVO-8S", color = colors.lime},
- { name = " Overworld ", adrs = "US7I-59S-SA", color = colors.purple},
- };
- nbitem = #address;
- print("init with "..nbitem.." address");
- mouseWidth = 0;
- mouseHeight = 0;
- hp = 0;
- print("monitor wrap "..screen)
- monitor = peripheral.wrap(screen);
- w,h=monitor.getSize();
- print(w)
- print(h)
- monitor.setBackgroundColor(colors.black);
- monitor.clear();
- hp = hp +1;
- monitor.setCursorPos(1,hp)
- monitor.write(" Close ");
- for key,value in pairs( address ) do
- hp = hp +1;
- monitor.setCursorPos(1,hp)
- monitor.setBackgroundColor(value.color);
- monitor.write(tostring(value.name));
- end
- print("portal wrap "..stargate);
- local ppor = peripheral.wrap(stargate);
- function checkClickPosition()
- if mouseHeight == 1 then
- ppor.disconnect();
- elseif mouseHeight ~= 1 and mouseHeight < nbitem then
- print(mouseHeight);
- print(address[mouseHeight - 1].adrs);
- ppor.dial(address[mouseHeight - 1].adrs);
- end
- end
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event=="monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement