mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
work to make documentation unified.
This commit is contained in:
@@ -1,22 +1,27 @@
|
||||
attempt() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: attempt(answer, fn[, hostname/ip=current ip, opts={}])
|
||||
.. js:function:: attempt(answer, filename[, hostname=current hostname[, opts={}]])
|
||||
|
||||
:RAM cost: 10 GB
|
||||
:param answer: Solution for the contract
|
||||
:param string fn: Filename of the contract
|
||||
:param string hostname/ip: Hostname or IP of the server containing the contract.
|
||||
:param string filename: Filename of the contract
|
||||
:param string hostname: Hostname of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
:param object opts: Optional parameters for configuring function behavior. Properties:
|
||||
|
||||
* returnReward (*boolean*) If truthy, then the function will return a string
|
||||
that states the contract's reward when it is successfully solved.
|
||||
:returns: ``true`` if the solution was correct. If the :code:`returnReward`
|
||||
option is configured, then the function will instead return a
|
||||
string. If the contract is successfully solved, the string will
|
||||
contain a description of the contract's reward. Otherwise, it will
|
||||
be an empty string.
|
||||
|
||||
Attempts to solve the Coding Contract with the provided solution.
|
||||
|
||||
:returns: Boolean indicating whether the solution was correct. If the :code:`returnReward`
|
||||
option is configured, then the function will instead return a string. If the
|
||||
contract is successfully solved, the string will contain a description of the
|
||||
contract's reward. Otherwise, it will be an empty string.
|
||||
Example:
|
||||
|
||||
:RAM cost: 10 GB
|
||||
.. code-block:: javascript
|
||||
|
||||
codingcontract.attempt("myanswer!", "contract-123.cct", "home");
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
getContractType() Netscript Function
|
||||
====================================
|
||||
|
||||
.. js:function:: getContractType(fn[, hostname/ip=current ip])
|
||||
|
||||
:param string fn: Filename of the contract
|
||||
:param string hostname/ip: Hostname or IP of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
|
||||
Returns a name describing the type of problem posed by the Coding Contract.
|
||||
(e.g. Find Largest Prime Factor, Total Ways to Sum, etc.)
|
||||
|
||||
:returns: A string with the contract's problem type
|
||||
.. js:function:: getContractType(filename[, hostname=current hostname])
|
||||
|
||||
:RAM cost: 5 GB
|
||||
:param string filename: Filename of the contract
|
||||
:param string hostname: Hostname of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
:returns: A string with the contract's problem type
|
||||
|
||||
Describes the type of problem posed by the Coding Contract.
|
||||
(e.g. Find Largest Prime Factor, Total Ways to Sum, etc.)
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
codingcontract.getContractType("contract-123.cct", "home");
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
getData() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: getData(fn[, hostname/ip=current ip])
|
||||
.. js:function:: getData(filename[, hostname=current hostname])
|
||||
|
||||
:param string fn: Filename of the contract
|
||||
:param string hostname/ip: Hostname or IP of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
:param string filename: Filename of the contract
|
||||
:param string hostname: Hostname of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
:returns: The specified contract's data. Different data type depending on
|
||||
contract type.
|
||||
|
||||
Get the data associated with the specific Coding Contract. Note that this is
|
||||
not the same as the contract's description. This is just the data that
|
||||
the contract wants you to act on in order to solve
|
||||
|
||||
:returns: The specified contract's data
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
data = codingcontract.getData("contract-123.cct", "home");
|
||||
answer = solve(data);
|
||||
codingcontract.attempt(answer, "contract-123.cct", "home");
|
||||
@@ -1,14 +1,18 @@
|
||||
getDescription() Netscript Function
|
||||
===================================
|
||||
|
||||
.. js:function:: getDescription(fn[, hostname/ip=current ip])
|
||||
|
||||
:param string fn: Filename of the contract
|
||||
:param string hostname/ip: Hostname or IP of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
|
||||
Get the full text description for the problem posed by the Coding Contract
|
||||
|
||||
:returns: A string with the contract's text description
|
||||
.. js:function:: getDescription(filename[, hostname=current hostname])
|
||||
|
||||
:RAM cost: 5 GB
|
||||
:param string filename: Filename of the contract
|
||||
:param string hostname: Hostname of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
:returns: A string with the contract's text description
|
||||
|
||||
Get the full text description for the problem posed by the Coding Contract.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
codingcontract.getDescription("contract-123.cct", "home");
|
||||
@@ -1,15 +1,19 @@
|
||||
getNumTriesRemaining() Netscript Function
|
||||
=========================================
|
||||
|
||||
.. js:function:: getNumTriesRemaining(fn[, hostname/ip=current ip])
|
||||
.. js:function:: getNumTriesRemaining(filename[, hostname=current hostname])
|
||||
|
||||
:param string fn: Filename of the contract
|
||||
:param string hostname/ip: Hostname or IP of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
:RAM cost: 2 GB
|
||||
:param string filename: Filename of the contract
|
||||
:param string hostname: Hostname of the server containing the contract.
|
||||
Optional. Defaults to current server if not provided
|
||||
:returns: Number indicating how many attempts are remaining
|
||||
|
||||
Get the number of tries remaining on the contract before it
|
||||
self-destructs.
|
||||
|
||||
:returns: Number indicating how many attempts are remaining
|
||||
Example:
|
||||
|
||||
:RAM cost: 2 GB
|
||||
.. code-block:: javascript
|
||||
|
||||
codingcontract.getNumTriesRemaining("contract-123.cct", "home"); // returns: 5
|
||||
Reference in New Issue
Block a user