Module screeps::raw_memory
source · Expand description
Interface for Screeps RawMemory
global object.
This is available as an alternative to the Memory
object in the js heap,
which itself is just a light wrapper around serializing into and
deserializing JSON into RawMemory
. String data stored can be retrieved
after the running bot code is restarted (either by the server or by a new
version of the code being uploaded) and decoded using serde or another
option.
Also contains functions for accessing memory segments and other players’ active foreign segments.
Structs
- The data from another user’s foreign memory segment, which can be retrieved by
foreign_segment
, after being requested on the previous tick byset_active_foreign_segment
.
Functions
- Get the foreign memory segment belonging to another player requested last tick.
- Get the stored serialized memory as a
JsString
. - Get a
JsHashMap<u8, String>
with all of the segments requested on the previous tick, with segment numbers as keys and segment data inJsString
form as values. - Overwrite the stored memory with a new
JsString
. Maximum allowed sizeMEMORY_SIZE_LIMIT
UTF-16 units. - Sets available foreign memory segment for the next tick to a memory segment marked as public by another user. If no id is passed, the user’s default public segment is retrieved.
- Sets available memory segments for the next tick, as an array of numbers from 0 to 99 (max of 10 segments allowed).
- Sets your default foreign memory segment for other players to read, or remove your public segment with
None
. - Sets which of your memory segments are readable to other players as foreign segments, overriding previous settings.