Registers
Registers work alongside State Connections to simulate advanced logic. They are very similar to formulae used in spreadsheets.
Registers work alongside State Connections to model advanced logic. They are very similar to formulae used in spreadsheets.
Registers perform operations, such as summing numbers. They use State Connections to access information about a component, and/or to transmit information to other components.
See the full list of Math.js functions usable in Machinations.
Beds are needed to house workers, and we need to stop the player from being able to buy workers when there are no beds free. For this, we can use Registers to keep track of how many beds are free.
Below, we will use Registers and State Connections to build out the Worker Beds mechanic.
First, place the Register and name it “Unoccupied Beds”.

Declaring variables
To calculate how many beds are free, we can use the following formula:
Unoccupied Beds = Worker Beds – Workers Employed
To compute this formula, the Register needs access to the quantities “Worker Beds” and “Workers Employed”.
To give the Register access to a quantity in your diagram, draw a State Connection from the component that contains that property (a Pool, Queue or Register) to the Register.
When the State Connection is drawn, it will be given a variable name. By default, the variable names will be alphabetical letters – “a, b, c, d…”
Writing the formula
Using the notation “a” and “b”, we now type the formula we defined above into the Register’s Formula field.


Now press Play. Notice that the register displays its calculation and updates as the number of Houses Built or Workers Hired increases.


You can rename your variables to make them specific to your diagram.
Best practice: Naming your Register variables greatly improves clarity on complex diagrams.
Applying the formula
Registers can be used like Pools and Queues to transmit their state to another component. In this case, we will use the Register to stop the hiring of Workers when no beds are available.
This Activator-type State Connection means that when there is at least one Unoccupied Bed (i.e. when the Register returns greater than 0), the player is able to hire a worker (i.e. the Hire Worker Converter is enabled). Otherwise, the action is unavailable.

