2019-03-13 00:05:38 +01:00
|
|
|
.. _netscript_sleeveapi:
|
|
|
|
|
|
|
|
Netscript Sleeve API
|
|
|
|
=========================
|
2019-03-18 06:04:12 +01:00
|
|
|
Netscript provides the following API for interacting with the game's
|
|
|
|
:ref:`Duplicate Sleeve <gameplay_duplicatesleeves>` mechanic.
|
2019-03-13 00:05:38 +01:00
|
|
|
|
|
|
|
The Sleeve API is **not** immediately available to the player and must be unlocked
|
|
|
|
later in the game.
|
|
|
|
|
2019-03-18 06:04:12 +01:00
|
|
|
.. warning:: This page contains spoilers for the game
|
2019-03-13 00:05:38 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
order to use this API in other BitNodes
|
|
|
|
|
|
|
|
**Sleeve API functions must be accessed through the 'sleeve' namespace**
|
|
|
|
|
|
|
|
In :ref:`netscript1`::
|
|
|
|
|
|
|
|
sleeve.synchronize(0);
|
|
|
|
sleeve.commitCrime(0, "shoplift");
|
|
|
|
|
|
|
|
In :ref:`netscriptjs`::
|
|
|
|
|
|
|
|
ns.sleeve.synchronize(0);
|
|
|
|
ns.sleeve.commitCrime(0, "shoplift");
|
|
|
|
|
|
|
|
.. toctree::
|
2019-03-18 06:04:12 +01:00
|
|
|
:caption: API Functions:
|
2019-03-13 00:05:38 +01:00
|
|
|
|
|
|
|
getNumSleeves() <sleeveapi/getNumSleeves>
|
2019-03-18 06:04:12 +01:00
|
|
|
getSleeveStats() <sleeveapi/getSleeveStats>
|
|
|
|
getInformation() <sleeveapi/getInformation>
|
2019-03-13 00:05:38 +01:00
|
|
|
getTask() <sleeveapi/getTask>
|
2019-03-18 06:04:12 +01:00
|
|
|
setToShockRecovery() <sleeveapi/setToShockRecovery>
|
|
|
|
setToSynchronize() <sleeveapi/setToSynchronize>
|
|
|
|
setToCommitCrime() <sleeveapi/setToCommitCrime>
|
|
|
|
setToFactionWork() <sleeveapi/setToFactionWork>
|
|
|
|
setToCompanyWork() <sleeveapi/setToCompanyWork>
|
|
|
|
setToUniversityCourse() <sleeveapi/setToUniversityCourse>
|
|
|
|
setToGymWorkout() <sleeveapi/setToGymWorkout>
|
2019-03-13 00:05:38 +01:00
|
|
|
travel() <sleeveapi/travel>
|
2019-04-05 11:08:41 +02:00
|
|
|
getSleeveAugmentations() <sleeveapi/getSleeveAugmentations>
|
|
|
|
getSleevePurchasableAugs() <sleeveapi/getSleevePurchasableAugs>
|
|
|
|
purchaseSleeveAug() <sleeveapi/purchaseSleeveAug>
|
2019-03-13 00:05:38 +01:00
|
|
|
|
2019-03-18 06:04:12 +01:00
|
|
|
.. _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.
|
2019-03-13 00:05:38 +01:00
|
|
|
|
|
|
|
Examples
|
|
|
|
--------
|
|
|
|
|
|
|
|
**Basic example usage**::
|
|
|
|
|
2019-03-18 06:04:12 +01:00
|
|
|
for (var i = 0; i < sleeve.getNumSleeves(); i++) {
|
2019-07-14 05:55:58 +02:00
|
|
|
sleeve.setToShockRecovery(i);
|
2019-03-13 00:05:38 +01:00
|
|
|
}
|
|
|
|
|
2019-07-14 05:55:58 +02:00
|
|
|
sleep(10 * 60 * 60); // wait 10h
|
2019-03-13 00:05:38 +01:00
|
|
|
|
2019-03-18 06:04:12 +01:00
|
|
|
for (var i = 0; i < sleeve.getNumSleeves(); i++) {
|
2019-07-14 05:55:58 +02:00
|
|
|
sleeve.setToSynchronize(i);
|
2019-03-13 00:05:38 +01:00
|
|
|
}
|
|
|
|
|
2019-03-18 06:04:12 +01:00
|
|
|
sleep(10*60*60); // wait 10h
|
2019-03-13 00:05:38 +01:00
|
|
|
|
2019-03-18 06:04:12 +01:00
|
|
|
for (var i = 0; i < sleeve.getNumSleeves(); i++) {
|
2019-07-14 05:55:58 +02:00
|
|
|
sleeve.setToCommitCrime(i, 'shoplift');
|
2019-03-13 00:05:38 +01:00
|
|
|
}
|