Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Stargate Interface

  1. Rotating Stargate functions
  2. Milky Way Stargate functions
  3. Pegasus Stargate functions
  4. Stargate functions
  5. Iris control

Functions

Unless there is a label with specific interface types displayed, the function can be used by any interface.
If there is a label, the function is only available for the specified interfaces.

This also applies to return values. Some return values might be only available for crystal or advanced crystal interface.

Crystal InterfaceAdvanced Crystal Interface

Rotating Stargate functions

Functions available for an interface connected to a Stargate that can be rotated – Classic, Universe and Milky Way Stargates.

Classic Stargate

Milky Way Stargate

Universe Stargate

encodeChevron()

source

Encodes the current symbol under the top chevron.

Milky Way stargate requires the chevron to be open, otherwise returns -35 (chevron_not_raised).

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

See also

Usage

  • Encode chevron
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local feedbackCode, message = interface.encodeChevron()
    -- The message is not available for basic interface
    print(feedbackCode, message)
    

endRotation()

source

Stops the inner ring rotation if it was started by a computer.
Does nothing if the ring is rotating due to a redstone signal.

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

See also

Usage

  • End the ring rotation
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local feedbackCode, message = interface.endRotation()
    -- The message is not available for basic interface
    print(feedbackCode, message) 
    

getCurrentSymbol()

source

Returns the current symbol under the top chevron. The symbol is allowed to not be exactly centered.

Returns

  1. number The symbol under the top chevron or -1 (e.g. when no symbol is at the top on the universe Stargate)

See also

Usage

  • Print the current symbol
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local symbol = interface.getCurrentSymbol()
    print(symbol) 
    

getRotation()

source

Returns the current Stargate’s ring rotation.

For Classic and Milky Way Stargates: 0 - 155
0 when the Point of Origin is centered under the top chevron.
Plus 4 for each symbol to the right centered under the top chevron,
152 for the last symbol (38) centered under the top chevron.

For Universe Stargate: 0 - 322
0 when the chevron to the left from the Point of Origin is centered at the top,
9 when the Point of Origin is centered at the top.

Returns

  1. number The current ring rotation based on the Stargate type.

See also

Usage

  • Check current ring rotation
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    while true do
      local rotation = interface.getRotation()
      print(rotation, "Hold Ctrl+T to stop the loop") 
      sleep(0)
    end
    

getRotationDegrees()

source

Returns the current Stargate’s ring rotation in degrees.

Returns

  1. number The current ring rotation in degrees [0 - 360]

See also

Usage

-- find any interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
while true do
    local rotationDegrees = interface.getRotationDegrees()
    print(rotationDegrees, "Hold Ctrl+T to stop the loop") 
    sleep(0)
end

isCurrentSymbol(symbol)

source

Returns true when the current symbol is centered under the top chevron, and it is the desired symbol specified as the parameter. Returns false otherwise.

Parameters

  1. symbol: number The desired symbol

Returns

  1. boolean Whether the current symbol is centered under the top chevron and matches the desired symbol.

See also

Usage

  • Await the rotation completion
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local symbol = 15
    interface.rotateClockwise(symbol)
    -- wait for the rotation until the desired symbol is reached
    while not interface.isCurrentSymbol(symbol) do
      sleep(0)
    end
    -- rotation complete
    print("The current symbol is "..symbol)
    

rotateAntiClockwise(symbol)

source

Rotates the Stargate’s ring anticlockwise, positioning the specified symbol centered under the top chevron.
The method does not block the execution for the whole rotation.
The rotation is stopped when the interface is destroyed.

Parameters

  1. symbol: number The desired symbol, or -1 for infinite rotation.

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

Throws

  • When the chevron is open or the symbol is not available on the Stargate.

See also

Usage

  • Rotate the ring anticlockwise to the symbol
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local symbol = 15
    -- start the rotation
    interface.rotateAntiClockwise(symbol)
    -- await the completion
    while not interface.isCurrentSymbol(symbol) do
      sleep(0)
    end
    -- rotation complete
    print("The current symbol is "..symbol)
    

rotateClockwise(symbol)

source

Rotates the Stargate’s ring clockwise, positioning the specified symbol centered under the top chevron.
The method does not block the execution for the whole rotation.
The rotation is stopped when the interface is destroyed.

Parameters

  1. symbol: number The desired symbol (from 0 to 38 inclusive), or -1 for infinite rotation

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

Throws

  • When the chevron is open or the symbol is out of range (lower than -1 or higher than 38).

See also

Usage

  • Rotate the ring clockwise to the symbol
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local symbol = 15
    -- start the rotation
    interface.rotateClockwise(symbol)
    -- await the completion
    while not interface.isCurrentSymbol(symbol) do
      sleep(0)
    end
    -- rotation complete
    print("The current symbol is "..symbol)
    

Milky Way Stargate functions

Functions exclusive to Milky Way stargate.

Milky Way Stargate

closeChevron()

source

Closes the upper chevron if it is open, encoding the current symbol.
If the symbol is already encoded, returns -2 (symbol_in_address).

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

See also

Usage

  • Close chevron
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local feedbackCode, message = interface.closeChevron()
    -- The message is not available for basic interface
    print(feedbackCode, message) 
    

isChevronOpen()

source

Returns true when the top chevron is open, false otherwise.

Returns

  1. boolean Whether the top chevron is open

See also

Usage

  • Check whether the top chevron is open
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local isOpen = interface.isChevronOpen()
    if isOpen then
      print("The chevron is open")
    else
      print("The chevron is closed")
    end 
    

openChevron()

source

Opens the top chevron in preparation for encoding the current symbol.

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

See also

Usage

  • Open the top chevron
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local feedbackCode, message = interface.openChevron()
    -- The message is not available for basic interface
    print(feedbackCode, message)
    

Pegasus Stargate functions

Functions exclusive for an interface connected to a Pegasus Stargate.

Pegasus Stargate

dynamicSymbols(enabled)

source

Controls the Stargate’s ability to dynamically switch symbols based on its location. The Stargate will keep this value when picked up.

When disabled, the symbols and the Point of Origin used by the Stargate can be overriden.

Parameters

  1. enabled: boolean Whether the Stargate should dynamically change symbols.

See also

Usage

  • Disables dynamically changing symbols
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.dynamicSymbols(false)
    

overrideSymbols(symbols)

source

Overrides the symbols used by the Stargate. This change is only a visual effect. The Stargate will reset its symbols based on its location when the chunk is unloaded. To keep the overridden symbols, disable dynamic symbols with dynamicSymbols(false).

All symbol options in the base mod are available on GitHub / data directory. Their textures are available in a different folder. More symbols can be added with datapacks and resourcepacks.

Note that unique symbols for solar systems can be seen only by players with unique_symbols config option enabled. By default, the rendered symbols will fall back to respective symbol set. See Stargate Technology / Stargate / Symbols / Symbols and Symbol sets for explanation.

Parameters

  1. symbols: string The resource location of the symbols.
    Examples: "sgjourney:galaxy_pegasus", "sgjourney:galaxy_milky_way"

See also

Usage

  • Overrides symbols to Milky Way galaxy
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.overrideSymbols("sgjourney:galaxy_milky_way")
    

overridePointOfOrigin(pointOfOrigin)

source

Overrides the Point Of Origin used by the Stargate. This change is only a visual effect. The Stargate will reset its Point Of Origin based on its location when the chunk is unloaded. To keep the overridden symbols, disable dynamic symbols with dynamicSymbols(false).

All Point Of Origin options in the base mod (more can be added by datapacks) are available in GitHub / data directory. Their textures are available in a different folder, look for subfolders with points of origins.

Parameters

  1. pointOfOrigin: string The resource location of the Point Of Origin. Examples: "sgjourney:terra", "sgjourney:tauri", "sgjourney:subido"

See also

Usage

  • Overrides the Point Of Origin to universal
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.overridePointOfOrigin("sgjourney:universal")
    

Stargate functions

Functions available for an interface connected to any Stargate.

Classic Stargate

Universe Stargate

Milky Way Stargate

Tollan Stargate

Pegasus Stargate

disconnectStargate()

source

Disconnects the Stargate if there is an active connection. The Stargate will be reset if it isn’t connected (encoded chevrons will be deactivated).

The Stargate won’t disconnect/reset if the connection is currently forming (after the final chevron is encoded and before the kawoosh finishes).

Returns

  1. boolean true if the connection was closed, false if there was no connection or the Stargate failed to disconnect (e.g. function was called during kawoosh).

See also

Usage

  • Disconnect the Stargate
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local result = interface.disconnectStargate()
    if result then
      print("Stargate disconnected")
    else
      print("Stargate is not open / Can not disconnect")
    end
    

engageStargate()

source

Confirms the encoded address and instructs the Stargate to initiate the connection. If the address is correct and the Stargate was able to connect to the destination Stargate, a wormhole will be established.

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

See also

Usage
The following example encodes an address for Abydos, waits until the Stargate encodes all the symbols and then engages the Stargate with a 3 second delay.

-- find any interface connected to the computer
-- this example requires at least crystal interface to work with engageSymbol method and any Stargate type
local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
-- encode an address
local address = {26, 6, 14, 31, 11, 29, 0}
local engageDirectly = false
local canEngageStargate = false
for index, symbol in pairs(address) do
    print(interface.engageSymbol(symbol, engageDirectly, canEngageStargate))
end
-- requested engaging all symbols waiting for Stargate to finish
while #interface.getDialedAddress() < #address do
    sleep(1)
end
-- because canEngageStargate is false, the Stargate will not activate by engaging point of origin
print("Address encoded, sleeping for 3s")
sleep(3)
print("Engaging Stargate now")
local feedbackCode, message = interface.engageStargate()
-- The message is not available for basic interface
print(feedbackCode, message)


getChevronsEngaged()

source

Returns a number from 0 to 9 which represents the number of chevrons that are engaged on the Stargate.

Returns

  1. number The number of chevrons that have been engaged (0 - 9).

Usage

  • Print the number of engaged chevrons
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local engaged = interface.getChevronsEngaged()
    print("Stargate has "..engaged.."/9 chevrons engaged")
    

getOpenTime()

source

Returns the number of ticks for which the Stargate has been active.

Returns

  1. number The number of ticks the Stargate has been active for, returns 0 if it’s inactive.

See also

Usage

  • Print the number of seconds for which the Stargate has been active
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local openTimeInTicks = interface.getOpenTime()
    -- each second has 20 ticks if the Stargate is not lagging
    local openTimeInSeconds = math.floor(openTimeInTicks / 20)
    print("Stargate has been open for "..openTimeInSeconds.." seconds")
    

getPointOfOrigin()

source

Returns a string of the resource location of the Point Of Origin.

Returns

  1. string The resource location of the Point Of Origin.

See also

Usage

  • Print the Point of Origin
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local PoO = interface.getPointOfOrigin()
    -- print the Point of Origin
    print("Stargate has Point of Origin: "..PoO)
    

getPublicBlacklist()

source

Advanced Crystal Interface

Returns a table with publicly visible addresses on the blacklist. Only addresses that were added to blacklist as public will be listed. Private blacklist cannot be listed.

Returns

  1. number[][] The table (array) of blacklisted addresses, each address is a table (array) of numbers (symbols).
    For example:
    {
     { 1, 2, 3, 4, 5, 6 },
     { 8, 7, 6, 5, 4, 3, 2, 1 }
    }
    

See also

Usage

  • Print public address on blacklist
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local publicBlacklist = interface.getPublicBlacklist()
    -- Print each address
    for _,address in pairs(publicBlacklist) do
      local text = interface.addressToString(address)
      print(text)
    end
    

getPublicWhitelist()

source

Advanced Crystal Interface

Returns a table with publicly visible addresses on the whitelist. Only addresses that were added to whitelist as public will be listed. Private whitelist cannot be listed.

Returns

  1. number[][] The table (array) of whitelisted addresses, each address is a table (array) of numbers (symbols).
    For example:
    {
     { 1, 2, 3, 4, 5, 6 },
     { 8, 7, 6, 5, 4, 3, 2, 1 }
    }
    

See also

Usage

  • Print public addresses on the whitelist
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local publicWhitelist = interface.getPublicWhitelist()
    -- Print each address
    for _,address in pairs(publicWhitelist) do
      local text = interface.addressToString(address)
      print(text)
    end
    

getRecentFeedback()

source

Returns information about the Stargate state.
For Crystal interfaces; this also returns a second string value with a status description.

Returns

  1. number The most recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

See also

Usage

  • Print the recent feedback
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local feedbackCode, feedbackMessage = interface.getRecentFeedback()
    print("Feedback code: "..feedbackCode)
    if feedbackMessage then
      print(feedbackMessage)
    else
      print("No description - advanced crystal interface required")
    end
    

getStargateEnergy()

source

Returns the amount of energy currently stored in the Stargate.

Returns

  1. number The energy [FE] stored within the Stargate

See also

Usage

  • Print the current amount of energy in the Stargate
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local energy = interface.getStargateEnergy()
    print("There is "..energy.." FE in the Stargate")
    

getStargateGeneration()

source

Returns the Stargate generation identifier.

0 - Classic Stargate
1 - Universe Stargate
2 - Milky Way Stargate, Tollan Stargate
3 - Pegasus

Returns

  1. number The generation of the Stargate

See also

Usage

  • Print the Stargate generation
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local generation = interface.getStargateGeneration()
    print("The Stargate is "..generation..". generation")
    

getStargateType()

source

Returns the Minecraft resource identifier for the Stargate.

Returns

  1. string The resource identifier of the Stargate
    Possible values:

    sgjourney:classic_stargate
    sgjourney:universe_stargate
    sgjourney:milky_way_stargate
    sgjourney:tollan_stargate
    sgjourney:pegasus_stargate

See also

Usage

  • Print the Stargate type
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local type = interface.getStargateType()
    print("The Stargate identifier: "..type)
    

getStargateVariant()

source

Returns the Minecraft resource identifier for the Stargate variant.

Returns

  1. string The Stargate variant resource identifier (e.g. sgjourney:milky_way_movie)
    or sgjourney:empty for the default Stargate variant

See also

Usage

  • Print the Stargate variant
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local variant = interface.getStargateVariant()
    print("The Stargate variant: "..variant)
    

getSymbols()

source

Returns a string of the resource location of the Symbols.

Returns

  1. string The resource location of the Symbols, e.g. sgjourney:terra

See also

Usage

  • Print the Symbols
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local symbols = interface.getSymbols()
    -- print the Symbols
    print("Stargate has Symbols: "..symbols)
    

isStargateConnected()

source

Check whether the Stargate is connected to another Stargate.

The function returns true even before kawoosh.
The Stargate is connected when it establishes a connection.
Once the Point of Origin is successfully encoded or the first chevron is being locked for an incoming connection.

Returns

  1. boolean Whether the Stargate has an active connection

See also

Usage

  • Check whether the Stargate is connected
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local isConnected = interface.isStargateConnected()
    if isConnected then
      print("Stargate is connected")
    else
      print("Stargate is not connected")
    end
    

isStargateDialingOut()

source

Returns true when there is an active outgoing connection (this Stargate dialed the other Stargate).

Returns

  1. boolean Whether the Stargate is currently connected and the connection is outgoing. Returns false otherwise (the Stargate is not connected or the connection is incoming).

See also

Usage

  • Check whether the active connection is outgoing
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local isDialingOut = interface.isStargateDialingOut()
    if isDialingOut then
      print("Stargate is dialing out")
    else
      print("The connection is incoming, or the Stargate is not active")
    end
    

isWormholeOpen()

source

Returns true if there is an active wormhole, after the kawoosh finishes, and it is safe to enter the wormhole, false otherwise.

Returns

  1. boolean Whether the wormhole has formed

See also

Usage

  • Check whether the wormhole has formed
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local isOpen = interface.isWormholeOpen()
    if isOpen then
      print("Wormhole is open")
    else
      print("Wormhole is not open")
    end
    
  • Check whether the wormhole is active and it is safe to enter
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    -- assuming the config uses default values (the reverse wormhole kills)
    local isConnected = interface.isStargateConnected()
    local isOpen = interface.isWormholeOpen()
    local isOutgoing = interface.isStargateDialingOut()
    if not isConnected then
      print("The Stargate is not connected")
    elseif not isOpen then
      -- The Stargate is connected, but the wormhole has not yet formed.
      print("The wormhole is forming")
    elseif isOutgoing then
      print("The wormhole is safe to enter")
    else
      print("The connection is incoming, do not enter the wormhole!")
    end
    

sendStargateMessage(message)

source

Sends the message through the current Stargate connection, which can be received by a computer on the other side as an event stargate_message_received.

Basic and Crystal interfaces can only send messages after the wormhole has fully formed (isWormholeOpen returns true).

The Advanced Crystal interface can send a message once the Stargate is connected (isStargateConnected returns true).

Any interface can receive the message.

Parameters

  1. message: string The message to send

Returns

  1. boolean Whether the message was sent successfully

See also

Usage

  • Send a message
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local message = "Hello from the other side"
    local wasSent = interface.sendStargateMessage(message)
    if wasSent then
      print("Message sent successfully")
    else
      print("The message could not be sent")
    end
    
  • Receive a message from the Stargate
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local message = os.pullEvent("stargate_message_received")
    print("Received a message from the Stargate:")
    print(message)
    

engageSymbol(symbol, engageDirectly, canEngageStargate)

source

Crystal InterfaceAdvanced Crystal Interface

Directly encodes the symbol. This method can encode symbols on any Stargate.

Using this method matches dialing with DHD.
For example, the Milky Way Stargate does not need to spin the ring; it just encodes chevrons directly.

Parameters

  1. symbol: number A symbol to encode. The symbol must be in a supported range by the Stargate type.
  2. engageDirectly: boolean (Optional, default: false) Whether to engage the symbol directly. Skips the rotation on Pegasus or Universe Stargates.
  3. canEngageStargate: boolean (Optional, default: true) Whether engaging the symbol can engage the Stargate and initiate a new connection.

Returns

  1. number The recent Stargate Feedback [int]
  2. string Crystal InterfaceAdvanced Crystal InterfaceA description of the feedback

See also

Usage

  • Dial the address
    -- find crystal or advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local address = { 26, 6, 14, 31, 11, 29, 0 } -- Abydos
    -- don't forgot the zero (Point of Origin) at the end!
    for _, symbol in pairs(address) do
      interface.engageSymbol(symbol)
      sleep(1)
    end
    

getDialedAddress()

source

Crystal InterfaceAdvanced Crystal Interface

Returns the address dialed by the Stargate.
If the currently active connection is incoming or there is no active connection, the address will be empty.

Returns

  1. number[]: The dialed address

See also

Usage

  • Print the dialed address
    -- find crystal or advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local address = interface.getDialedAddress()
    print("The dialed address: " .. interface.addressToString(address))
    

getMappedSymbol(symbol)

source

Crystal InterfaceAdvanced Crystal Interface

Returns the mapped symbol for the given symbol. If the symbol was not mapped, returns the same symbol.

Parameters

  1. symbol: number The symbol to lookup.

Returns

  1. number: The mapped symbol, or the requested symbol if not mapped.

See also

Usage

-- find crystal or advanced crystal interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
local symbol = 1
local mappedSymbol = interface.getMappedSymbol(symbol)
if symbol == mappedSymbol then
    print("Symbol "..symbol.." is not mapped")
else
    print("Symbol "..symbol.." is mapped to "..mappedSymbol)
end

hasDHD()

source

Crystal InterfaceAdvanced Crystal Interface

Checks whether there is a DHD connected to the Stargate.

Returns

  1. boolean: true if there is a DHD connected to the Stargate, false otherwise.

Usage

-- find crystal or advanced crystal interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
-- TODO: example usage
local hasDHD = interface.hasDHD()
print(hasDHD)

remapSymbol(originalSymbol, newSymbol)

source

Crystal InterfaceAdvanced Crystal Interface

Remaps a symbol so that the newSymbol is represented by the originalSymbol.
After mapping, encoding originalSymbol physically encodes originalSymbol on the Stargate, but adds the newSymbol to the dialed address.

The point of origin (symbol 0) cannot be used in remapping.

originalSymbol → newSymbol

Parameters

  1. originalSymbol: number The original symbol that will represent the newSymbol.
    Must not be 0 or symbol already physically encoded on the Stargate.
  2. newSymbol: number The new symbol that will be added to the dialed address instead of the originalSymbol
    Must not be 0 or symbol already in the dialed address.

Returns

  1. boolean: true if the symbol was remapped successfully, false otherwise.

See also

Usage

-- find crystal or advanced crystal interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
local originalSymbol = 1
local newSymbol = 38
interface.remapSymbol(originalSymbol, newSymbol)
interface.engageSymbol(originalSymbol)
-- original symbol physically encoded on the Stargate
local address = interface.getDialedAddress()
print(interface.addressToString(address)) 
-- newSymbol was appended to the address

setChevronConfiguration(configuration)

source

Crystal InterfaceAdvanced Crystal Interface

Causes the chevrons to encode in the order specified by configuration. This configuration resets every time a Stargate is reset.

Parameters

  1. configuration: number[] An array of length 8 representing the order of chevrons.
    Possible chevron numbers are 1, 2, 3, 4, 5, 6, 7, 8. The top chevron is always encoded as the last one, this can’t be changed.
Chevron numbers

Chevron numbers on the Stargate

Returns

  1. string The message "Chevron configuration set successfully"

Throws

  • When specified configuration is invalid. The configuration must be an array of exact length 8 with numbers from 1 to 8 without duplicates.

See also

Usage

  • Set the default chevron order
    -- find crystal or advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.setChevronConfiguration({1, 2, 3, 6, 7, 8, 4, 5})
    
  • Set clockwise chevron order (e.g. when encoding 9-chevron address).
    -- find crystal or advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.setChevronConfiguration({1, 2, 3, 4, 5, 6, 7, 8})
    

addNetwork(network)

source

Crystal InterfaceAdvanced Crystal Interface

Adds the Stargate to the given network.

Parameters

  1. network: number The number of the network to which the Stargate should be added.

Returns

  1. boolean: true if the Stargate was added to the network and wasn’t in it already, false otherwise.

See also

Usage

-- find an advanced crystal interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
local network = 415252 -- could be any number
local added = interface.addNetwork(network)
if added then
    print("Stargate was added to network "..network)
else
    print("Failed to add Stargate to network")
end

addToBlacklist(address, isPublic)

source

Advanced Crystal Interface

Adds the address to the blacklist. When the filter is set to the blacklist type, the Stargate will not be able to form a connection with the address on the blacklist. That being said, the Stargate can’t dial the address or accept a connection from the blacklisted address.

The added address can be either private or public. By default, the address is added as private. Private addresses cannot be listed, but they are still being blacklisted and can be removed with removeFromBlacklist(address). If an address is already listed and an attempt to add it again is made, with a different visibility, the specified visibility is applied and updated in the blacklist. The method returns false in such case, since the address was already on the blacklist.

Blacklisting a 9-chevron address will block all 9-chevron address connections from/to that specific Stargate. However, a connection using a 7/8-chevron address could still be made from/to the Stargate with a blacklisted 9-chevron address. Similarly, blacklisting a 7/8-chevron address will block all 7/8-chevron connections from/to the Stargate. However, it will not block 9-chevron connections from/to such Stargates.

Parameters

  1. address: number[] The 7, 8 or 9-chevron address to be added to the blacklist (without the trailing zero - Point of Origin).
  2. isPublic: boolean (Optional, default: false) Whether the address should be added as public. The public blacklist contents are accessible with getPublicBlacklist(). The contents of the private blacklist cannot be listed.

Returns

  1. boolean: true if the address was added to the blacklist and was not present before, false if the address was already on the blacklist.

Throws

  • When the specified address is invalid (the only allowed lengths are 6, 7 and 8).

See also

Usage

  • Blacklist a 9-chevron address
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local address = { 16, 25, 4, 21, 6, 19, 33, 22 }
    interface.clearBlacklist()
    interface.setFilterType(-1) -- set filter to blacklist mode
    interface.addToBlacklist(address)
    -- now the Stargate will not be able to dial the specified address 
    -- or accept a 9-chevron connection from the other Stargate.
    

addToWhitelist(address, isPublic)

source

Advanced Crystal Interface

Adds the address to the whitelist. When the filter is set to the whitelist type, the Stargate will not be able to form a connection with the address that is not on the whitelist. That being said, the Stargate can’t dial the address or accept a connection from an address that is not on the whitelist.

The added address can be either private or public. By default, the address is added as private. Private addresses cannot be listed, but they are still being whitelisted and can be removed with removeFromWhitelist(address). If an address is already listed and an attempt to add it again is made, with a different visibility, the specified visibility is applied and updated in the whitelist. The method returns false since the address was already on the whitelist.

Whitelisting a 9-chevron address will allow all 9-chevron address connections from/to that specific Stargate. However, a connection using a 7/8-chevron address will not be possible from/to the Stargate with a blacklisted 9-chevron address. Similarly, whitelisting a 7/8-chevron address will allow all 7/8-chevron connections from/to the Stargate. However, it will not allow 9-chevron connections from/to such Stargates.

Parameters

  1. address: number[] The 7, 8 or 9-chevron address to be added to the whitelist.
  2. isPublic: boolean (Optional, default: false) Whether the address should be added to the public whitelist.

Returns

  1. boolean: true if the address was added to the whitelist and was not present before, false if the address was already on the whitelist.

Throws

  • When the specified address is invalid (the only allowed lengths are 6, 7 and 8).

See also

Usage

  • Whitelist the Abydos 7-chevron address
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local address = { 26, 6, 14, 31, 11, 29 }
    interface.clearWhitelist()
    interface.setFilterType(1) -- set filter to whitelist mode
    interface.addToWhitelist(address)
    -- now the Stargate can only estabilish a connection with a Stargate 
    -- on Abydos using the 7-chevron address
    -- all 8-chevron and 9-chevron connections are blocked
    -- including such connections with Stargates on Abydos
    -- only 7-chevron connection from/to Abydos is possible
    

clearBlacklist()

source

Advanced Crystal Interface

Removes all addresses from the blacklist. Including all public and all private addresses.

Returns

  1. string: A message "Blacklist cleared" source

See also

Usage

  • Remove all addresses from the blacklist
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.clearBlacklist()
    -- blacklist is now empty
    

clearWhitelist()

source

Advanced Crystal Interface

Removes all addresses from the whitelist. Including all public and all private addresses.

Returns

  1. string: A message "Whitelist cleared" source.

See also

Usage

  • Remove all addresses from the whitelist
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.clearWhitelist()
    -- whitelist is now empty
    

getConnectedAddress()

source

Advanced Crystal Interface

Returns the address to which the Stargate is connected (the address on the other side of the connection).

Returns

  1. number[]: The remote 7, 8 or 9-chevron address of the connection

The address is partially filled when a connection is forming and the Stargate is locking the chevrons for an incoming connection.

To ensure the address has full length, the isWormholeOpen() must return true.

For an outgoing connection, the address is always either empty or full-length.

See also

Usage

  • Print the remote address
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    if interface.isWormholeOpen() then
      local address = interface.getConnectedAddress()
      print("The remote address is "..interface.addressToString(address))
    else
      print("Wormhole not formed")
    end
    

getFilterType()

source

Advanced Crystal Interface

Returns the numeric identifier of the filter type.

0 None
1 Whitelist
-1 Blacklist

Returns

  1. number: The filter type identifier

See also

Usage

  • Print the current filter type
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local type = interface.getFilterType()
    if type == 0 then
      print("Filter is disabled")
    elseif type == 1 then
      print("Filter is in whitelist mode")
    elseif type == -1 then
      print("Filter is in blacklist mode")
    end 
    

getLocalAddress()

source

Advanced Crystal InterfaceReturns the 9-chevron address of this (local) Stargate.

Returns

  1. number[]: The 9-chevron address

See also

Usage

  • Print the local address
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local localAddress = interface.getLocalAddress()
    print(interface.addressToString(localAddress))
    

getNetworks()

source

Crystal InterfaceAdvanced Crystal Interface

Returns the list of networks to which the Stargate has been assigned.

Returns

  1. number[] The list of Stargate’s networks

See also

Usage

-- find an advanced crystal interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
-- TODO: example usage
local networks = interface.getNetworks()
for _,network in pairs(networks) do
    print(network)
end

isNetworkRestricted()

source

Crystal InterfaceAdvanced Crystal Interface

Checks for the network restrictions of the Stargate.

Returns

  1. boolean: Whether are the network restrictions active

See also

Usage

  • Print whether the Stargate is network restricted
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local isRestricted = interface.isNetworkRestricted()
    if isRestricted then
      print("Network restriction is active")
    else
      print("Network restriction is not active")
    end
    

removeFromBlacklist(address)

source

Advanced Crystal Interface

Removes the specified address from the blacklist.

Parameters

  1. address: number[] The address to remove from blacklist

Returns

  1. boolean: true if the address was on blacklist and was successfully removed, false otherwise.

Throws

  • When the specified address is invalid.

See also

Usage

  • Remove the address from the blacklist
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local address = { 16, 25, 4, 21, 6, 19, 33, 22 }
    interface.removeFromBlacklist(address)
    

removeFromWhitelist(address)

source

Advanced Crystal Interface

Removes the specified address from the whitelist.

Parameters

  1. address: number[] The address to remove from whitelist

Returns

  1. boolean: true if the address was on whitelist and was successfully removed, false otherwise.

Throws

  • When the specified address is invalid.

See also

Usage

-- find an advanced crystal interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
local address = { 26, 6, 14, 31, 11, 29 }
interface.removeFromWhitelist(address)

removeNetwork(network)

source

Advanced Crystal Interface

Removes the Stargate from the given network.

Each Stargate has its default network based on its generation. If the Stargate is not in any other network, it is always in its default network from which it can not be removed.

Parameters

  1. network: number The network from which the Stargate should be removed.

Returns

  1. boolean: true if the Stargate was in the network and was successfully removed, false otherwise.

See also

Usage

-- find an advanced crystal interface connected to the computer
local interface = peripheral.find("advanced_crystal_interface")
if interface == nil then
    error("The interface is not connected")
end
-- use the interface:
local network = 415252 -- could be any number
interface.removeNetwork(network)

restrictNetwork(restrict)

source

Advanced Crystal Interface

Sets the status of Network Restrictions of the Stargate.

Parameters

  1. restrict: number Whether the network restriction should be enabled, disabled or respect the DHD.

    number < 0 Network restrictions will be disabled
    number = 0 Network restrictions will respect the DHD
    number > 0 Network restrictions will be enabled

See also

Usage

  • Enable network restriction
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    interface.restrictNetwork(1)
    

setFilterType(type)

source

Advanced Crystal InterfaceSets the filter type for the Stargate.

Only one filter type can be active, either whitelist, or blacklist (or none to disable the filter).

Parameters

  1. type: number The identifier of the filter type

    0 None
    1 Whitelist
    -1 Blacklist

Returns

  1. number: the filter type identifier that was set

See also

Usage

  • Set the filter type to blacklist
    -- find an advanced crystal interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local FilterType = { 
      None = 0,
      Whitelist = 1,
      Blacklist = -1
    }
    interface.setFilterType(FilterType.Blacklist)
    

Iris control

Iris related methods are available even when the Stargate does not have an iris installed. However, they are not available for the Tollan Stargate which can’t have an iris.

Milky Way Stargate with Iris

getIris()

source

Retrieves the identifier of the currently installed iris on the Stargate.

Returns

  1. string: The identifier of the iris (e.g. sgjourney:naquadah_alloy_iris)
    Returns nil if there is no iris installed

Usage

  • Check the installed iris
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local iris = interface.getIris()
    if iris then
      print("The Stargate has an iris installed: "..iris)
    else
      print("The Stargate does not have an iris installed")
    end
    

closeIris()

source

Instruct the Iris to start closing. The function does not wait for the iris to close.

Returns

  1. boolean: false when the iris is already being closed (in motion) by a computer, true otherwise. true if no iris is installed on the Stargate.

See also

Usage

  • Close the iris
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local closing = interface.closeIris()
    if closing then
      print("Closing the iris...")
    else
      print("The iris is already being closed by a computer...")
    end
    

openIris()

source

Instruct the Iris to start opening. The function does not wait for the iris to open.

Returns

  1. boolean: false when the iris is already being opened (in motion) by a computer, true otherwise. true if no iris is installed on the Stargate.

See also

Usage

  • Open the iris
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local opening = interface.openIris()
    if opening then
      print("Opening the iris...")
    else
      print("The iris is already being opened by a computer...")
    end
    

stopIris()

source

Instruct the Iris to stop. The function does not wait for the iris to stop.

Returns

  1. boolean: false when the iris is already being stopped by a computer, true otherwise. true if no iris is installed on the Stargate.

See also

Usage

  • Stop the iris
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local stopped = interface.stopIris()
    if stopped then
      print("Stopped the iris...")
    else
      print("The iris is already being stopped by a computer...")
    end
    

getIrisProgress()

source

Retrieves the internal iris closing progress.
This progress is internally used for blocking the Stargate by the iris.

Returns

  1. number: The internal iris closing progress

    0 when the iris is fully opened or not installed on the Stargate
    58 when the iris is fully closed.

See also


getIrisProgressPercentage()

source

Retrieves the percentage of the iris closing progress.

Returns

  1. number: The percentage (decimal) of the iris closing progress

    0 when the iris is fully opened or not installed on the Stargate
    100 when the iris is fully closed

See also

Usage

  • Get the iris closing percentage
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local progress = interface.getIrisProgressPercentage()
    if progress == 0 then
      print("Iris is open")
    elseif progress == 100 then
      print("The iris is fully closed")
    else
      print("The iris is "..math.floor(progress).."% closed")
    end
    

getIrisDurability()

source

Retrieves the iris’ remaining durability.

Returns

  1. number: The remaining durability of the iris

See also

Usage

  • Get the iris durability
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local durability = interface.getIrisDurability()
    local maxDurability = interface.getIrisMaxDurability()
    print("The iris durability: "..durability.."/"..maxDurability.." "..math.floor(durability/maxDurability*100).."%")
    

getIrisMaxDurability()

source

Retrieves the iris’ maximum durability.

Returns

  1. number: The maximum iris durability

See also

Usage

  • Get the iris durability
    -- find any interface connected to the computer
    local interface = peripheral.find("advanced_crystal_interface") or peripheral.find("crystal_interface") or peripheral.find("basic_interface")
    if interface == nil then
      error("The interface is not connected")
    end
    -- use the interface:
    local durability = interface.getIrisDurability()
    local maxDurability = interface.getIrisMaxDurability()
    print("The iris durability: "..durability.."/"..maxDurability.." "..math.floor(durability/maxDurability*100).."%")