Im trying to make Draconic Evotution portal (one portal for 16 destination without using turtles) that is controlled with Advanced computer.
I figured out how to transport Charms of dislocation in and out of receptacal, that was the easy part it took like five minutes.
Now im not a programmer or any way related to coding. That is why i was trying to get someone's code to serve my purpose.
Was not lucky.
Only option remained to find someones code and modify to fit my needs.
So i did.
Here is the original:
Who made this thanks. I have lost the authors name.
The program:
Spoiler
disk="/disk/"
todisk=0
local programs = {
cc10remote="mbEHZZnh",
cc10host="CR92ZjdE ",
WiReServer="hqpRw4Jy",
WiReClient="jtFa7V1n",
Foo="3fnFhwvd",
Foo2="2Zf5an8H",
LightCon="yqJdet4j ",
DeadGlass="2uY6KeNa ",
QuarryPC="6smzHGJY",
QuarryTurtle="rpXRAZs4",
QuarryRepeater="Te359WA2",
Ladder="u8ubAuT4",
TreeFarm="bbpeedQ7",
VertShaft="XyyFJ4xk",
BundledControl="GxDwxLBi",
MFSUmon="Tr8rWtUV",
gpsdeploy="QEqtfgRR",
ccreStartup="NGXLKpfA",
}
local wired = {
cc10host="CR92ZjdE ",
WiReClient="jtFa7V1n",
startup="NGXLKpfA",
}
local termX, termY = term.getSize()
local function centerPrint(text, y)
term.setCursorPos(termX/2-#text/2, y)
term.write(text)
end
local menu_options = {
[1] = "Turtle Programs";
[2] = "PC Programs";
[3] = "Handheld Programs";
[4] = "Other Programs";
[5] = "Exit";
}
local turtle_options = {
[1] = "GPS-Build";
[2] = "Ladder Program";
[3] = "Replicator Program";
[4] = "Auto Tree Farm";
[5] = "Back";
}
local pc_options = {
[1] = "Setup Remote Host";
[2] = "WiRe Server";
[3] = "Lighting Control v1.3";
[4] = "Bundled Cable Control";
[5] = "Rednet Message Display";
[6] = "DeadGlass";
[7] = "Back";
}
local pocket_options = {
[1] = "cc10 Remote Control";
[2] = "Back";
}
local other_options = {
[1] = "Download all programs to Disk";
[2] = "Back";
}
function welcomeBack()
term.clear()
term.setTextColour(colors.red)
print("Welcome Back Commander....")
sleep(1)
end
function Close()
shell.run("clear")
print("Goodbye....")
sleep(1)
shell.run("clear")
error()
end
function mainMenu()
shell.run("clear")
term.setTextColour(colors.white)
local startY = termY/2-#menu_options/2
for i=1, #menu_options do
centerPrint("["..i.."] "..menu_options[i], startY)
startY = startY + 1
end
term.setCursorPos(1, termY)
term.write("Press a number to select the menu option...")
local selected = false
while true do
local e = {os.pullEvent()}
if e[1] == "char" then
if menu_options[tonumber(e[2])] then
selected = tonumber(e[2])
break
end
end
end
print("You've selected: ".. menu_options[selected])
if selected == 1 then turtleMenu()
elseif selected == 2 then PCMenu()
elseif selected == 3 then PocketMenu()
elseif selected == 4 then OtherMenu()
elseif selected == 5 then Close()
else
return
end
end -- func mainMenu
function PCMenu()
shell.run("clear")
term.setTextColour(colors.white)
local startY = termY/2-#pc_options/2
for i=1, #pc_options do
centerPrint("["..i.."] "..pc_options[i], startY)
startY = startY + 1
end
term.setCursorPos(1, termY)
term.write("Press a number to select the menu option...")
local selected = false
while true do
local e = {os.pullEvent()}
if e[1] == "char" then
if pc_options[tonumber(e[2])] then
selected = tonumber(e[2])
break
end
end
end
print("You've selected: ".. pc_options[selected])
if selected == 1 then
shell.run("rm", "startup")
for name,code in pairs(wired) do
shell.run("pastebin", "get",code,name)
end
shell.run("clear")
print("Restarting...")
sleep(1)
shell.run("clear")
print("Please make sure a wireless modem is attached....")
write("Press any key to continue")
os.pullEvent("key")
shell.run("startup")
elseif selected ==2 then
print("Downloading WiReClient....")
shell.run("rm", "startup")
shell.run("pastebin", "get", "hqpRw4Jy", "startup")
print("WiReClient Download Complete....")
shell.run("startup")
elseif selected ==3 then
shell.run("rm", "startup")
print("Downloading Lighting Control v1.3....")
shell.run("pastebin", "get", "ScRu9crS", "button")
print("LightControl Api Download Complete....")
shell.run("pastebin", "get", "0f455rvM", "startup")
print("LightControl Program Download Complete....")
print("Monitor required is x4 wide by x3 high ....")
shell.run("startup")
elseif selected ==4 then
shell.run("rm", "startup")
print("Downloading Bundled Cable Control PC....")
shell.run("pastebin", "get", "GxDwxLBi", "startup")
print("Bundled Cable Control Download Complete....")
print("Recommend a x2 Wide by x3 High Monitor Block....")
write("Press any key to continue")
os.pullEvent("key")
print("Starting Program....")
shell.run("startup")
elseif selected ==5 then
shell.run("rm", "startup")
print("Downloading Rednet Message Display....")
shell.run("pastebin", "get", "65esSnuB", "startup")
print("Rednet Message Display Download Complete....")
print("Starting Program....")
shell.run("startup")
elseif selected ==6 then
shell.run("rm", "startup")
print("Downloading DeadGlass....")
shell.run("pastebin", "get", "bbpeedQ7", "startup")
print("DeadGlass Download Complete....")
print("Recommend a x2 Wide by x3 High Monitor Block....")
print("Starting Program....")
shell.run("startup")
elseif selected ==7 then
mainMenu()
else
return
end
end -- func PCMenu
function turtleMenu()
shell.run("clear")
term.setTextColour(colors.white)
local startY = termY/2-#turtle_options/2
for i=1, #turtle_options do
centerPrint("["..i.."] "..turtle_options[i], startY)
startY = startY + 1
end
term.setCursorPos(1, termY)
term.write("Press a number to select the menu option...")
local selected = false
while true do
local e = {os.pullEvent()}
if e[1] == "char" then
if turtle_options[tonumber(e[2])] then
selected = tonumber(e[2])
break
end
end
end
print("You've selected: ".. turtle_options[selected])
if selected == 1 then
print("Downloading GPS-Builder....")
shell.run("pastebin", "get", "QEqtfgRR", "gpsbuilder")
print("GPS-Builder Download Complete....")
elseif selected ==2 then
print("Downloading Ladder Builder....")
shell.run("pastebin", "get", "u8ubAuT4", "ladder")
print("Ladder Builder Download Complete....")
shell.run("ladder")
elseif selected ==3 then
write "Version 1 or 2? "
write "1, 2? "
input = read()
if input == "1" then
print("Downloading Replicator Program v1....")
shell.run("rm", "startup")
shell.run("pastebin", "get", "3fnFhwvd", "startup")
print("Replicator Program Download Complete....")
shell.run("startup")
elseif input == "2" then
print("Downloading Replicator Program v2....")
shell.run("rm", "startup")
shell.run("pastebin", "get", "2Zf5an8H", "startup")
print("Replicator Program Download Complete....")
shell.run("startup")
end
elseif selected ==4 then
shell.run("rm", "startup")
print("Downloading Auto Tree Farm....")
shell.run("pastebin", "get", "bbpeedQ7", "startup")
print("Auto Tree Farm Download Complete....")
print("Starting Program....")
shell.run("startup")
elseif selected ==5 then
mainMenu()
else
return
end
end -- func TurtleMenu
function PocketMenu()
shell.run("clear")
term.setTextColour(colors.white)
local startY = termY/2-#pocket_options/2
for i=1, #pocket_options do
centerPrint("["..i.."] "..pocket_options[i], startY)
startY = startY + 1
end
term.setCursorPos(1, termY)
term.write("Press a number to select the menu option...")
local selected = false
while true do
local e = {os.pullEvent()}
if e[1] == "char" then
if pocket_options[tonumber(e[2])] then
selected = tonumber(e[2])
break
end
end
end
print("You've selected: ".. pocket_options[selected])
if selected == 1 then
print("Downloading cc10 Remote....")
shell.run("pastebin", "get", "mbEHZZnh", "cc10")
print("cc10host Complete....")
shell.run("cc10")
end
if selected == 2 then
mainMenu()
else
return
end
end -- func pocketMenu
function OtherMenu()
shell.run("clear")
term.setTextColour(colors.white)
local startY = termY/2-#other_options/2
for i=1, #other_options do
centerPrint("["..i.."] "..other_options[i], startY)
startY = startY + 1
end
term.setCursorPos(1, termY)
term.write("Press a number to select the menu option...")
local selected = false
while true do
local e = {os.pullEvent()}
if e[1] == "char" then
if other_options[tonumber(e[2])] then
selected = tonumber(e[2])
break
end
end
end
print("You've selected: ".. other_options[selected])
if selected == 1 then
print("Downloading All Scripts to Disk....")
for name,code in pairs(programs) do
shell.run("pastebin", "get",code, "/disk/",name)
print("Mass Download Complete....")
end
elseif selected ==2 then
mainMenu()
else
return
end
end
term.clear()
term.setTextColour(colors.red)
local password = "ada"
print ("Enter Password")
local input = read("*")
if input == password then
term.setTextColour(colors.green)
print("Password is correct. Access granted.")
sleep(1)
welcomeBack()
mainMenu()
function findMonitor()
local face
if (peripheral.find("monitor"))and(peripheral.isPresent("left")) then
face="left"
print("Monitor Found on " .. face)
return true, face
elseif (peripheral.find("monitor"))and(peripheral.isPresent("right")) then
face="right"
print("Monitor Found on " .. face)
return true, face
elseif (peripheral.find("monitor"))and(peripheral.isPresent("bottom")) then
face="bottom"
print("Monitor Found on " .. face)
return true, face
elseif (peripheral.find("monitor"))and(peripheral.isPresent("top")) then
face="top"
print("Monitor Found on " .. face)
return true, face
elseif (peripheral.find("monitor"))and(peripheral.isPresent("back")) then
face="back"
print("Monitor Found on " .. face)
return true,face
else
face=""
print("No Monitor Found")
return false,face
end
end
function findModem()
if peripheral.find("modem") then
print("Modem Found")
fMo()
else
print("Modem NOT Found")
end
end
function fMo()
local function openRednet()
for _,side in ipairs({"top", "bottom", "front", "left", "right", "back"}) do
if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
rednet.open(side)
return side
end
end
print("no wifi present")
end
modemSide = openRednet()
if modemSide == nil then
print("No modem connected")
else
print("Opened modem on "..modemSide)
end
end
--findMonitor()
--findModem()
end
From spoiler, that i added, iv took out two codes, one was button (api), secound was startup.
Startup - https://pastebin.com/0f455rvM
Button (API) - https://pastebin.com/ScRu9crS
So i started modifying it to serve my needs.
I havnt started with adding bunduled output's for fun1() till fun16(). But i belive that i will manage that.
My problem is.
when ever i load the program - i press button('s) "1-8" or "9-16" , computer stops the program and writes:
button: 74: attempt to index ? (a nill value).
I did read forum's topic "Read This Post Before Asking Questions"
but it didnt made any sense for me. i tried to fix it but my trying made it worse.
so im baisicly stuck.
modified codes:
Button(api) - https://pastebin.com/Z6zq3TW3
Startup - https://pastebin.com/xF6LiU5G
Here are some of in game screens-shoots.
Spoiler
First image is when program is running and nothing is pressed.Spoiler
Spoiler
Spoiler
Thanks for reading this. Hope someone can help with this.