for _,v in pairs(arg) do
if v == "--help" then
print("Danger's Dialler Command-Line Arguments: (Argument / Function)")
print("WARNING! ALL FLAGS ARE FOR TESTING ONLY AND MAY DESTABILISE THE PROGRAM\nUSE AT OWN RISK")
print("--help / Prints this help menu")
print("--verbose / Displays extremely detailed information about the program state")
print("--forcePegasus / Forces the program to assume a Pegasus Stargate")
print("--forceMilky / Forces the program to assume a Milky Way Stargate")
return
elseif v == "--verbose" then
verbose = true
print("Verbose mode on")
elseif v == "--forceMilky" then
forceMilky = true
bypassAuto = true
print("Forcing Milky Way Stargate")
elseif v == "--forcePegasus" then
forcePegasus = true
bypassAuto = true
print("Forcing Pegasus Stargate")
elseif v == "--kripMode" then
terribleMode = true
print("Terrible mode activated!")
elseif v then
print(arg)
error("Program failed to initalise, bad flags", 0)
end
end
if forceMilky == true and forcePegasus == true then
error("You cannot force Milky and Pegasus, please select one or the other", 0)
return
end
function verboseInfo(text)
if verbose == true then
print(text)
end
end
interface = peripheral.find("basic_interface") or peripheral.find("crystal_interface") or peripheral.find("advanced_crystal_interface")
verboseInfo("Interface initalised")
iris = peripheral.find("redstoneIntegrator")
verboseInfo("Iris initalised")
if interface then
verboseInfo("Stargate found!")
sleep(0)
else
error("Stargate not found! Please connect a gate and ensure the interface is connected.", 0)
return
end
if iris then
verboseInfo("Iris found!")
irisPresent = true
else
verboseInfo("Iris not found, iris functionality will be disabled")
irisPresent = false
end
if interface.engageSymbol ~= nil then
verboseInfo("Pegasus / Universe Gate Detected")
if bypassAuto == false then
forcePegasus = true
verboseInfo("No force arguments detected, automatically setting gate type")
end
elseif interface.rotateClockwise ~= nil then
verboseInfo("Milky Gate Detected")
if bypassAuto == false then
forceMilky = true
verboseInfo("No force arguments detected, automatically setting gate type")
end
end
--Stargate dialling function, this basically just lets you dial the gate whenever called
Assistant
The addresses ending with 0 in this code are likely related to the concept of a "Point of Origin" in the context of a Stargate dialing system, inspired by the Stargate science fiction franchise. In the Stargate universe, an address consists of a series of symbols representing constellations, and the final symbol is always the Point of Origin, which marks the location of the Stargate from which you are dialing.
In this lua script, the list of addresses is represented with numbers, with the last number in each address being , signifying the Point of Origin. This means that every address for a destination ends with , consistent with the requirement to include a Point of Origin symbol in the address dialing sequence.
User
how to use this then if i enter code manually, ui didnt have 0 in it
Assistant
To manually enter a Stargate address using this script, it's important to understand how the script is expecting input. The script is designed with a command-line interface where users can input commands to trigger specific actions, such as dialing an address. Here's a step-by-step guide on how to manually enter a custom address using this script:
Start the Program: Run the script in its environment. This could be within a Turtle or Computer system in a Minecraft mod if this is based on something like ComputerCraft. Wait for the initialization messages to finish.
User
it`s minecraft mod, how to enter code in UI , without 0
Assistant
If you're working with a Minecraft mod that simulates a Stargate (such as the SGCraft mod), and the user interface (UI) for dialing addresses doesn't require you to manually enter the 0 as the Point of Origin, then the 0 is likely being handled automatically by the system. However, if you're manually entering addresses into a UI where 0 is not needed, you should enter just the main portion of the address without the . Here's what you can do:
function dial(address)
if verbose == true then
print("Primary dialling function called with value: "..tostring(address))
end
if forceMilky == true then
verboseInfo("Milky dial in progress...")
local addressLength = #address
local start = interface.getChevronsEngaged() + 1
for chevron = start,addressLength,1
do
local symbol = address[chevron]
if chevron % 2 == 0 then
interface.rotateClockwise(symbol)
else
interface.rotateAntiClockwise(symbol)
end
while(not interface.isCurrentSymbol(symbol))
do
sleep(0)
end
sleep(0.5)
interface.raiseChevron()
sleep(0.5)
interface.lowerChevron()
sleep(0.5)
end
elseif forcePegasus == true then
verboseInfo("Pegasus / Universe dial in progress...")
local addressLength = #address
local start = interface.getChevronsEngaged() + 1
for chevron = start,addressLength,1
do
local symbol = address[chevron]
interface.engageSymbol(symbol)
end
end
end
-- Gate reset function, attempts to unjam the gate should it become stuck during a dialling sequence
function resetGate()
clearScreen()
local x = 0
print("Resetting gate...")
if forceMilky == true then
while x ~= 10 do
x = x + 1
interface.lowerChevron()
os.sleep(0.1)
interface.raiseChevron()
os.sleep(0.1)
end
interface.lowerChevron()
interface.rotateClockwise(0)
interface.raiseChevron()
interface.lowerChevron()
interface.disconnectStargate()
if interface.isStargateConnected() == true then
print("Stargate successfully reset")
else
print("Was unable to reset gate")
end
elseif forcePegasus == true then
while x ~= 10 do
x = x + 1
interface.engageSymbol(0)
end
if interface.isStargateConnected() == false then
print("Stargate successfully reset")
else
print("Was unable to reset gate")
end
end
end
-- Address Database (Will be a file in the future)
--Do note, if you're adding an address yourself, YOU MUST APPEND IT WITH A 0 AS THE PoO!
verboseInfo("Address database initalised")
-- Iris sanity check on boot (Useful is the iris was left on and the program reboots, makes sure to set the correct values in memory)
if iris then
if iris.getOutput("back") == true then
irisToggle = 0
verboseInfo("Iris sanity check performed, iris state set to 0")
elseif iris.getOutput("back") == false then
irisToggle = 1
verboseInfo("Iris sanity check performed, iris state set to 1")
end
end
-- Draw the main page whenever a command is issued
function mainPage()
verboseInfo("mainPage function called")
print("TEMPORARY: Stargate Control Interface, please select and input a command below")
print("To reset the stargate should it become stuck, type "reset"")
print("To toggle the iris, type "iris" or press 1")
print("To terminate the wormhole, type "shutdown" or press 2")
print("To enter a custom address, type "custom"")
print("\nType 'page' followed by a number to print a list of addresses to dial, or type the destination name")
print("E.G 'page 1' for the first page")
print("(Please note, additional addresses are on page 3)")
end
function addressList(page)
verboseInfo("addressList function called with value: not implemented")
page = tonumber(page)
if page == 69 then
clearScreen()
print("Nice")
elseif page == 1 then
clearScreen()
print("Dial Abydos (3)")
print("Dial Chulak (4)")
print("Dial Lantea (5)")
print("Dial The End (6)")
print("Dial Nether (7)")
elseif page == 2 then
clearScreen()
print("Ad Astra and other non-functioning Addresses\n")
print("Dial New Athos (8)")
print("Dial The Moon (9)")
print("Dial Mars (10)")
print("Dial Venus (11)")
print("Dial Glacio (12)")
elseif page == 3 then
clearScreen()
print("Custom addresses:\n")
print("Dial Spawn (13)")
print("Dial Mining Dimension (14)")
print("For more entries, bug Danger")
else
clearScreen()
print("No other entries exist!")
end
end
--Refresh screen
function clearScreen()
term.clear()
term.setCursorPos(1, 1)
mainPage()
verboseInfo("clearScreen function called")
end
-- Gate dialling subroutine, prints relevant information to the console and dials the gate
function startDial(address, name, isIntergalactic, isDirect)
if verbose == true then
print("Secondary dialling subroutine called with the following values: "..tostring(address)..", "..name..", "..tostring(isIntergalactic)..", "..tostring(isDirect))
end
interface.disconnectStargate()
os.sleep(1)
if interface.isStargateConnected() == true then
verboseInfo("Stargate connection check passed")
clearScreen()
print("Cannot dial out, wormhole will not close! (Is the call incoming?)")
else
term.clear()
term.setCursorPos(1, 1)
if address == customAddress then
print("Dialling custom address: "..tostring(customAddress))
dial(address)
sleep(0.5)
else
if isIntergalactic == true then
print("Warning! Intergalactic dialling in progress!")
end
if isDirect == false then
print("Dialling "..name.."...")
dial(address)
sleep(0.5)
elseif isDirect == true then
print("Direct dialling "..name.."...")
dial(address)
sleep(0.5)
end
end
if forcePegasus == true then
local counter = 0
print("Waiting for dialling to complete...")
if counter <= 30 then
while interface.getChevronsEngaged() < 7 do
os.sleep(1)
counter = counter + 1
end
elseif counter == 30 then
clearScreen()
print("Gate failed to respond during timeout period. Dial aborted.")
end
if interface.getChevronsEngaged() >= 7 then
verboseInfo("Greater than or equal to 7 chevrons engaged, starting timer...")
os.sleep(10)
end
if interface.isStargateConnected() == false then
clearScreen()
print("Dialling failed! Destination may be buried, incorrectly entered, or insufficient power to complete dialling procedure.")
elseif interface.isStargateConnected() == true then
clearScreen()
print(name.." dialled!")
end
else
if interface.isStargateConnected() == false then
clearScreen()
print("Dialling failed! Destination may be buried, incorrectly entered, or insufficient power to complete dialling procedure.")
elseif interface.isStargateConnected() == true then
clearScreen()
print(name.." dialled!")
end
end
end
end
--Iris control subroutine
function irisControl()
verboseInfo("irisControl subroutine called")
if iris then
term.clear()
term.setCursorPos(1, 1)
if irisToggle == 1 then
iris.setOutput("back", true)
irisToggle = 0
clearScreen()
verboseInfo("Iris state presently 1, setting 0 and enabling iris")
print("Shield raised!")
elseif irisToggle == 0 then
iris.setOutput("back", false)
irisToggle = 1
clearScreen()
verboseInfo("Iris state presently 0, setting 1 and disabling iris")
print("Shield dropped!")
end
else
clearScreen()
print("Iris not found!")
end
end
--Wormhole termination subroutine
function closeWormhole()
verboseInfo("closeWormhole function called")
if interface.isStargateConnected() == true then
interface.disconnectStargate()
os.sleep(1)
if interface.isStargateConnected() == true then
resetGate()
if interface.isStargateConnected() == true then
clearScreen()
print("Failed to close wormhole!")
end
else
clearScreen()
print("Wormhole closed!")
end
else
clearScreen()
print("Wormhole is not engaged!")
end
end
while terribleMode == true do
resetGate()
print("FIRE IN THE HOLE!")
end
-- Main subroutine to draw the address database (Will be converted into a function of its own)
mainPage()
while true do
os.queueEvent("randomEvent")
os.pullEvent("randomEvent")
local msg = read()
local _, _, pageNumber = string.find(msg, "page%s*(%d+)")
--Format is as follows for the startDial subroutine, Destination first as "xAddress", followed by the display name you wish to show, followed by being whether or not it is a intergalactic dial, then if it a direct dial to a gate
if msg == "" then
clearScreen()
elseif pageNumber then
addressList(pageNumber)
elseif msg == "reset" then
resetGate()
elseif msg == "custom" then
customAddress = {}
term.clear()
term.setCursorPos(1, 1)
print("Custom destination selection:")
print("To dial a custom destination, please type your address in the following format\nBe sure not to include spaces or any other text")
print("\n\nExample address, "1,2,3,4,5,6,0", where 0 is the Point of Origin")
print("\nCustom Address: ")
local custom = read()
for value in custom:gmatch("[^,]+") do
table.insert(customAddress, tonumber(value))
end
startDial(customAddress, "Custom Address", false, false)
--CUSTOM ADDRESS DIALLING HERE
elseif msg == "1" or msg == "iris" then
irisControl()
elseif msg == "2" or msg == "shutdown" then
closeWormhole()
elseif msg == "3" or msg == "abydos" then
startDial(abydosAddress, "Abydos", false, false)
elseif msg == "4" or msg == "chulak" then
startDial(chulakAddress, "Chulak", false, false)
elseif msg == "5" or msg == "lantea" then
startDial(lanteaAddress, "Lantea", true, false)
elseif msg == "6" or msg == "midway" or msg == "end" or msg == "the end" then
startDial(endAddress, "The End", false, false)
elseif msg == "7" or msg == "nether" then
startDial(netherAddress, "the Nether", false, true)
elseif msg == "8" or msg == "athos" or msg == "newathos" or msg == "new athos" then
startDial(newAthosAddress, "New Athos", true, false)
elseif msg == "9" or msg == "moon" or msg == "the moon" or msg =="themoon" then
startDial(moonAddress, "The Moon", false, true)
elseif msg == "10" or msg == "mars" then
startDial(marsAddress, "Mars", false, true)
elseif msg == "11" or msg == "venus" then
startDial(venusAddress, "Venus", false, true)
elseif msg == "12" or msg == "glacio" then
startDial(glacioAddress, "Glacio", true, true)
elseif msg == "13" or msg == "spawn" then
startDial(spawnAddress, "Spawn", false, true)
elseif msg == "14" or msg == "mining dim" or msg == "mining" or msg =="miningdim" or msg == "mine" then
startDial(miningDimAddress, "Mining Dimension", false, true)
else
clearScreen()
print("Invalid command! Please check your input or bug Danger about his bad code")
end
end
0
0
Here’s a breakdown of why this detail is significant in the script:
Address Format: The format {...0} ensures that all addresses are complete as per the Stargate dialing protocol. The 0 acts as the Point of Origin needed to define the starting point of the journey through the Stargate network.
Consistency: By append the 0 at the end of each address, the Dialler program maintains consistency in how it processes and dials each address.
Technical Implementation: The script appears to interface with hardware (or an API emulating hardware) related to dialing a Stargate, simulating or managing input for commands that would dial specific gates, support error handling, and handle different Stargate types.
Program Instruction: Within the comments and the function descriptions, it's noted multiple times, especially at locations like --Do note, if you're adding an address yourself, YOU MUST APPEND IT WITH A 0 AS THE PoO!, clarifying to anyone using or maintaining the code that the format must include the 0 to function correctly.
Thus, the ending 0 is likely a specific implementation requirement to represent the Point of Origin in this theoretical Stargate system, aligning with the themes from the associated media property.
Access the Custom Address Entry:
At the command prompt, type custom and press Enter. This will clear the screen and prompt you to enter a custom address.
Enter the Address:
Enter your custom address in the format specified by the script. The address should be a comma-separated list of numbers, and it must end with 0 to represent the Point of Origin.
Example input:
1,2,3,4,5,6,0
Ensure there are no spaces or additional characters between the numbers or around commas.
Verification and Dial:
After entering the address, the script will attempt to dial it using the startDial function. It checks whether the address is properly set and then carries out the dialing sequence based on specified arguments (like whether it's intergalactic or direct).
Troubleshoot if Necessary:
If the script doesn't recognize your input, it will show an error message on the interface. Ensure your input adheres strictly to the instructed format.
If there's a failure in dialing, consider inspecting the script settings to ensure all peripherals are properly initialized and connected.
Remember, the interface must support your entry and the use case, particularly within the correct environment, for the script to execute as expected. If 0 is not appearing in the UI but is needed, it's essential to manually append it based on the script’s requirements during address entry.
0
UI Address Input:
Open the Stargate dialing interface within the game.
Enter the combination of symbols or number sequence that represents your destination address, excluding the final 0. For example, if the address in the script is {26,6,14,31,11,29,0}, you would enter 26,6,14,31,11,29 in the game's UI.
Automated Handling:
Many mods handle the Point of Origin automatically, as it is often tied to the specific Stargate you are using to dial out. This means you only need to enter the destination symbols, and the mod appends the Point of Origin internally.
Script Adaptation:
If you're modifying or interacting with a script and need to account for the 0 being absent, consider updating the script logic where the addresses are parsed or used. This helps ensure the script correctly modifies its behavior based on the environment.
Script Output:
If debugging or logging is necessary, ensure any addresses output by the script (in logs or commands) match the in-game format. This might involve stripping the 0 when showing output but including it programmatically where needed.
Game Environment Constraints:
Confirm that all necessary peripherals or systems the script depends upon are connected and configured in the game. This includes any interfaces or redstone integrators that might be interacting with the Stargate.
In many cases, the operational logic between the script and the mod is built to obfuscate complex operations for simplicity during gameplay. Ensure any address handling changes you make align with how the mod and the script are expected to operate.