mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 00:04:22 +02:00
Changed Sleeve API functions to prevent conflicts with identically-named functions
This commit is contained in:
@@ -4,6 +4,8 @@ Netscript Advanced Functions
|
||||
These Netscript functions become relevant later on in the game. They are put on a separate page because
|
||||
they contain spoilers for the game.
|
||||
|
||||
.. warning:: This page contains spoilers for the game
|
||||
|
||||
.. toctree::
|
||||
|
||||
getBitNodeMultipliers() <advancedfunctions/getBitNodeMultipliers>
|
||||
|
||||
@@ -7,7 +7,7 @@ Netscript provides the following API for interacting with the game's Bladeburner
|
||||
The Bladeburner API is **not** immediately available to the player and must be unlocked
|
||||
later in the game
|
||||
|
||||
**WARNING: This page contains spoilers for the game**
|
||||
.. warning:: This page contains spoilers for the game
|
||||
|
||||
The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
|
||||
automatically gain access to this API. Otherwise, you must have Source-File 7 in
|
||||
|
||||
@@ -6,7 +6,7 @@ Netscript provides the following API for interacting with the game's Gang mechan
|
||||
The Gang API is **not** immediately available to the player and must be unlocked
|
||||
later in the game
|
||||
|
||||
**WARNING: This page contains spoilers for the game**
|
||||
.. warning:: This page contains spoilers for the game
|
||||
|
||||
The Gang API is unlocked in BitNode-2. Currently, BitNode-2 is the only location
|
||||
where the Gang mechanic is accessible. This may change in the future
|
||||
|
||||
@@ -9,7 +9,7 @@ and creating programs.
|
||||
|
||||
The Singularity Functions are **not** immediately available to the player and must be unlocked later in the game.
|
||||
|
||||
**WARNING: This page contains spoilers for the game**.
|
||||
.. warning:: This page contains spoilers for the game
|
||||
|
||||
The Singularity Functions are unlocked in BitNode-4. If you are in BitNode-4, then you will automatically have access to all of these functions.
|
||||
You can use the Singularity Functions in other BitNodes if and only if you have the Source-File for BitNode-4 (aka Source-File 4). Each level of
|
||||
@@ -20,7 +20,7 @@ Note that Singularity Functions require twice as much RAM outside of BitNode-4
|
||||
|
||||
.. toctree::
|
||||
:caption: Functions:
|
||||
|
||||
|
||||
universityCourse() <singularityfunctions/universityCourse>
|
||||
gymWorkout() <singularityfunctions/gymWorkout>
|
||||
travelToCity() <singularityfunctions/travelToCity>
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
Netscript Sleeve API
|
||||
=========================
|
||||
Netscript provides the following API for interacting with the game's Sleeve mechanic.
|
||||
Netscript provides the following API for interacting with the game's
|
||||
:ref:`Duplicate Sleeve <gameplay_duplicatesleeves>` mechanic.
|
||||
|
||||
The Sleeve API is **not** immediately available to the player and must be unlocked
|
||||
later in the game.
|
||||
|
||||
**WARNING: This page contains spoilers for the game**
|
||||
.. warning:: This page contains spoilers for the game
|
||||
|
||||
The Sleeve API is unlocked in BitNode-10. If you are in BitNode-10, you will
|
||||
automatically gain access to this API. Otherwise, you must have Source-File 10 in
|
||||
@@ -26,40 +27,50 @@ In :ref:`netscriptjs`::
|
||||
ns.sleeve.commitCrime(0, "shoplift");
|
||||
|
||||
.. toctree::
|
||||
:caption: Functions:
|
||||
:caption: API Functions:
|
||||
|
||||
commitCrime() <sleeveapi/commitCrime>
|
||||
getNumSleeves() <sleeveapi/getNumSleeves>
|
||||
getTask() <sleeveapi/getTask>
|
||||
synchronize() <sleeveapi/synchronize>
|
||||
travel() <sleeveapi/travel>
|
||||
workForFaction() <sleeveapi/workForFaction>
|
||||
getSleeveStats() <sleeveapi/getSleeveStats>
|
||||
getInformation() <sleeveapi/getInformation>
|
||||
getStats() <sleeveapi/getStats>
|
||||
shockRecovery() <sleeveapi/shockRecovery>
|
||||
takeUniversityCourse() <sleeveapi/takeUniversityCourse>
|
||||
workForCompany() <sleeveapi/workForCompany>
|
||||
workoutAtGym() <sleeveapi/workoutAtGym>
|
||||
getTask() <sleeveapi/getTask>
|
||||
setToShockRecovery() <sleeveapi/setToShockRecovery>
|
||||
setToSynchronize() <sleeveapi/setToSynchronize>
|
||||
setToCommitCrime() <sleeveapi/setToCommitCrime>
|
||||
setToFactionWork() <sleeveapi/setToFactionWork>
|
||||
setToCompanyWork() <sleeveapi/setToCompanyWork>
|
||||
setToUniversityCourse() <sleeveapi/setToUniversityCourse>
|
||||
setToGymWorkout() <sleeveapi/setToGymWorkout>
|
||||
travel() <sleeveapi/travel>
|
||||
|
||||
.. _netscript_sleeveapi_referencingaduplicatesleeve:
|
||||
|
||||
Referencing a Duplicate Sleeve
|
||||
------------------------------
|
||||
Most of the functions in the Sleeve API perform an operation on a single Duplicate
|
||||
Sleeve. In order to specify which Sleeve the operation should be performed on,
|
||||
a numeric index is used as an identifier. The index should follow array-notation, such
|
||||
that the first Duplicate Sleeve has an index of 0, the second Duplicate Sleeve has
|
||||
an index of 1, and so on.
|
||||
|
||||
The order of the Duplicate Sleeves matches the order on the UI page.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
**Basic example usage**::
|
||||
|
||||
for(let i = 0; i < sleeve.getNumSleeves(); i++) {
|
||||
for (var i = 0; i < sleeve.getNumSleeves(); i++) {
|
||||
sleeve.shockRecovery(i);
|
||||
}
|
||||
|
||||
await sleep(10*60*60); // wait 10h
|
||||
sleep(10*60*60); // wait 10h
|
||||
|
||||
for(let i = 0; i < sleeve.getNumSleeves(); i++) {
|
||||
for (var i = 0; i < sleeve.getNumSleeves(); i++) {
|
||||
sleeve.synchronize(i);
|
||||
}
|
||||
|
||||
await sleep(10*60*60); // wait 10h
|
||||
sleep(10*60*60); // wait 10h
|
||||
|
||||
for(let i = 0; i < sleeve.getNumSleeves(); i++) {
|
||||
for (var i = 0; i < sleeve.getNumSleeves(); i++) {
|
||||
sleeve.commitCrime(i, 'shoplift');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
commitCrime() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: commitCrime(sleeveNumber, name)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to start commiting crime.
|
||||
:param string name: Name of the crime. Must be an exact match.
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
|
||||
Returns false if an invalid action is specified.
|
||||
@@ -3,7 +3,7 @@ getInformation() Netscript Function
|
||||
|
||||
.. js:function:: getInformation(sleeveNumber)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to retrieve information.
|
||||
:param int sleeveNumber: Index of the sleeve to retrieve information. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
|
||||
Return a struct containing tons of information about this sleeve
|
||||
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
getStats() Netscript Function
|
||||
=======================================
|
||||
getSleeveStats() Netscript Function
|
||||
===================================
|
||||
|
||||
.. js:function:: getStatus(sleeveNumber)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to get stats of.
|
||||
:param int sleeveNumber: Index of the sleeve to get stats of. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
|
||||
Return a structure containing the stats of the sleeve
|
||||
|
||||
@@ -3,7 +3,7 @@ getTask() Netscript Function
|
||||
|
||||
.. js:function:: getTask(sleeveNumber)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to retrieve task from.
|
||||
:param int sleeveNumber: Index of the sleeve to retrieve task from. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
|
||||
Return the current task that the sleeve is performing. type is set to "Idle" if the sleeve isn't doing anything
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
setToCommitCrime() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: setToCommitCrime(sleeveNumber, name)
|
||||
|
||||
:param int sleeveNumber: Index of the sleeve to start commiting crime. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
:param string name: Name of the crime. Must be an exact match.
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
|
||||
Returns false if an invalid action is specified.
|
||||
@@ -0,0 +1,9 @@
|
||||
setToCompanyWork() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: setToCompanyWork(sleeveNumber, companyName)
|
||||
|
||||
:param int sleeveNumber: Index of the sleeve to work for the company. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
:param string companyName: Name of the company to work for.
|
||||
|
||||
Return a boolean indicating whether or not the sleeve started working or this company.
|
||||
@@ -0,0 +1,10 @@
|
||||
setToFactionWork() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: setToFactionWork(sleeveNumber, factionName, factionWorkType)
|
||||
|
||||
:param int sleeveNumber: Index of the sleeve to work for the faction. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
:param string factionName: Name of the faction to work for.
|
||||
:param string factionWorkType: Name of the action to perform for this faction.
|
||||
|
||||
Return a boolean indicating whether or not the sleeve started working or this faction.
|
||||
@@ -0,0 +1,10 @@
|
||||
setToGymWorkout() Netscript Function
|
||||
====================================
|
||||
|
||||
.. js:function:: setToGymWorkout(sleeveNumber, gymName, stat)
|
||||
|
||||
:param int sleeveNumber: Index of the sleeve to workout at the gym. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
:param string gymName: Name of the gym.
|
||||
:param string stat: Name of the stat to train.
|
||||
|
||||
Return a boolean indicating whether or not the sleeve started working out.
|
||||
@@ -0,0 +1,8 @@
|
||||
setToShockRecovery() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: setToShockRecovery(sleeveNumber)
|
||||
|
||||
:param int sleeveNumber: Index of the sleeve to start recovery. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
@@ -0,0 +1,8 @@
|
||||
setToSynchronize() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: setToSynchronize(sleeveNumber)
|
||||
|
||||
:param int sleeveNumber: Index of the sleeve to start synchronizing. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
@@ -0,0 +1,10 @@
|
||||
setToUniversityCourse() Netscript Function
|
||||
==========================================
|
||||
|
||||
.. js:function:: setToUniversityCourse(sleeveNumber, university, className)
|
||||
|
||||
:param int sleeveNumber: Index of the sleeve to start taking class. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
:param string university: Name of the university to attend.
|
||||
:param string className: Name of the class to follow.
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
@@ -1,8 +0,0 @@
|
||||
shockRecovery() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: shockRecovery(sleeveNumber)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to start recovery.
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
@@ -1,8 +0,0 @@
|
||||
synchronize() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: synchronize(sleeveNumber)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to start synchronizing.
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
@@ -1,10 +0,0 @@
|
||||
takeUniversityCourse() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: takeUniversityCourse(sleeveNumber, university, className)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to start taking class.
|
||||
:param string university: name of the university to attend.
|
||||
:param string className: name of the class to follow.
|
||||
|
||||
Return a boolean indicating whether or not this action was set successfully.
|
||||
@@ -3,7 +3,7 @@ travel() Netscript Function
|
||||
|
||||
.. js:function:: travel(sleeveNumber, cityName)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to travel.
|
||||
:param string cityName: name of the destination city.
|
||||
:param int sleeveNumber: Index of the sleeve to travel. See :ref:`here <netscript_sleeveapi_referencingaduplicatesleeve>`
|
||||
:param string cityName: Name of the destination city.
|
||||
|
||||
Return a boolean indicating whether or not the sleeve reached destination.
|
||||
Return a boolean indicating whether or not the sleeve reached destination.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
workForCompany() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: workForCompany(sleeveNumber, companyName)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to work for the company.
|
||||
:param string companyName: name of the company to work for.
|
||||
|
||||
Return a boolean indicating whether or not the sleeve started working or this company.
|
||||
@@ -1,10 +0,0 @@
|
||||
workForFaction() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: workForFaction(sleeveNumber, factionName, factionWorkType)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to work for the faction.
|
||||
:param string factionName: name of the faction to work for.
|
||||
:param string factionWorkType: name of the action to perform for this faction.
|
||||
|
||||
Return a boolean indicating whether or not the sleeve started working or this faction.
|
||||
@@ -1,10 +0,0 @@
|
||||
workoutAtGym() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: workoutAtGym(sleeveNumber, gymName, stat)
|
||||
|
||||
:param int sleeveNumber: index of the sleeve to workout at the gym.
|
||||
:param string gymName: name of the gym.
|
||||
:param string stat: name of the stat to train.
|
||||
|
||||
Return a boolean indicating whether or not the sleeve started working out.
|
||||
Reference in New Issue
Block a user