DarwinBotsManual
Open the app EspañolES

.memloc

Chooses which cell of the memory of the bot you are looking at gets copied into .memval.

Facts

Address
474
Name
.memloc
Kind
Command: the bot writes it and the engine reads it and usually consumes it
Group
Memory (memloc, memval and genetic)
Written by
Your DNA.
Read by
The engine, every time it fills .memval with the bot you see. It only uses addresses 1 to 1000.
Cleared
Nobody: it stays until you change it. A child is born with 0.
Range
−32000 to 32000; only 1 to 1000 are useful, with no range adjustment
Mutations
picked as a store target

It is a configuration sysvar: you write an address and the engine uses it every cycle to fill .memval with what that cell holds in the bot you are looking at. It is never cleared, so writing it once is enough, for example with a gene that runs only while it is 0.

Only addresses from 1 to 1000 work. Unlike a store, there is no adjustment to the range here: with 1061 .memloc store the cell holds 1061 and .memval stays at 0, it does not spy on cell 61.

' Only once: spy on the DNA length of the bot I see
cond
*.memloc 0 =
start
.dnalen .memloc store
stop

Note that .dnalen goes without an asterisk: what is stored is the address of .dnalen (336), not its value. With that, *.memval *.dnalen = asks whether the bot you see has the same DNA length as yours. You can spy on any cell: a sysvar of the other one, like its .eye5, or one of its private variables. To spy through a tie, use .tmemloc.