Skip to content

The science module

Overview

API: science

scan(path=None, buttons=None, timeout=None, auto_side=True)

Start a science scan

Parameters:

Name Type Description Default
path str

The path of scripted scan data. Default is None.

None
buttons dict

dictionary key = button, value = label. Defaults to None.

None
timeout Promise

A promise typically by calling timeout(). Defaults to None.

None
auto_side bool

If true quickly scans thing on the same side. Defaults to True.

True

Returns:

Name Type Description
Promise

A promise to wait. Typically passed to an await/AWAIT

scan_results(message, target=None, tab=None)

Set the scan results for the current scan. This should be called when the scan is completed. This is typically called as part of a scan() This could also be called in response to a routed science message. When paired with a scan() the target and tab are not needed. Tab is the variable SCAN_TAB, target is track

Parameters:

Name Type Description Default
message str

Scan text for a scan that is in progress.

required
target Any

Not currently used. Default is None.

None
tab str

Scan tab for a scan that is in progress. Default is None.

None

science_add_scan(message, label=None, data=None, path=None)

Add a scan button. Args: message (str): The text contents of the button. label (str | Label): The label to run when the button is pressed. data (dict, optional): Data associated with this button. path (str, optional): The path to follow when the button is pressed.

science_ensure_scan(ids_or_objs, target_ids_or_objs, tabs='scan')

Checks that the target objects have been scanned by the specified objects. Args: ids_or_objs (set[Agent | int]): The scanning ship(s) target_ids_or_objs (set[Agent | int]): The targeted ship(s)

science_get_scan_data(origin, target, tab='scan')

Get the science scan as seen by the ship doing the scan. Args: origin (int | Agent): The ship doing the scan target (int |Agent): The target space object tab (str): The science tab the info goes to Returns: str: The applicable scan data

science_has_scan_data(origin, target, tab='scan')

Check if the target is has scan data for the scanning ship. Args: origin (int | Agent): The ship doing the scan (probably a player ship) target (int | Agent): The target space object tab (str): The science tab being checked (optional, default is 'scan') Returns: bool: True if the scan data exists

science_is_unknown(origin, target)

Check if the target is known to the given ship.
Based on the 'scan' tab on the science widget.
To use a different tab, use science_has_scan_data() instead
Args: origin (int | Agent): The ship doing the scan (probably a player ship) target (int | Agent): The target space object

science_navigate(path)

Navigate to a particular comms path. Must be called on the GUI task for science. Args: path (str): The comms button path to which the GUI will navigate.

science_set_2dview_focus(client_id, focus_id=0)

Set the specified client to focus its 2D view on the specified alternate ship. Args: client_id (int): The client id focus_id (int, optional): The object on which to focus.

science_set_scan_data(player_id_or_obj, scan_target_id_or_obj, tabs)

Immediately set the science scan data for a scan target. Use this for things that you do not want to have scan delayed.

Parameters:

Name Type Description Default
player_id_or_obj Agent | int

The player ship agent id or object

required
scan_target_id_or_obj Agent | int

The target ship agent id or object

required
tabs dict

A dictionary to key = tab, value = scan string

required

science_update_scan_data(origin, target, info, tab='scan')

Immediately update the scan data of the target space object for the scanning ship. NOTE: Only use this if the scanning ship has already scanned the target, and the scan text needs to be updated, or if you want to forcibly add the scan info a ship even if it hasn't been scanned yet. Args: origin (int | Agent): The scanning ship (probably a player ship) target (int | Agent): The object being scanned info (str): The new scan information tab (str): The science tab to which the info belongs (e.g. 'scan' or 'intel')

show_warning(t)

Same as print(t). Prints a message to the F7 screen. Args: t (str): The string to display.

start_science_message(event)

This is how AUTOSCAN AUTO SCAN is accomplished

Parameters:

Name Type Description Default
event event

The event that triggered the auto scan.

required

start_science_selected(event)

Trigger a science scan to begin. Args: event (event): The event that triggered the scan.