On the Dynamics of Integration/Tutorials
This page contains all tutorials inside On the Dynamics of Integration, as they are written inside the book.
Menril Basics[edit | edit source]
After that, you’ll need to craft a Squeezer and Drying Basin for processing Menril Wood. This can be done by placing a block of wood in the Squeezer and jumping on it until it's flat. Once that has been done, the Menril Resin will try to go to the two sides of the Squeezer. Next, place a Drying Basin next to the Squeezer to make it fill with the Menril Resin you just squeezed.
If you want to repeat the process, you can reset the Squeezer by applying a redstone pulse.
Network Foundations[edit | edit source]
The main goal of this mod is for building control networks for automation. This is done using Logic Cables. Try making a network with ten of those cables.
The next step will be to craft some Variable Cards and Variable Transformers. Variable Cards are used to store references to values in the network. Variable Transformers are crafting elements for components that can be placed on Logic Cables for reading and writing these values.
Basic Network Components[edit | edit source]
One of the methods for binding Variable Cards to certain values, is by reading in values from Readers. Let’s start by crafting some basic readers. After that, craft a Display Panel, which is useful for displaying the values of Variable Cards.
Aspects[edit | edit source]
As a simple example, let’s try reading in a redstone value and displaying it.
After that, right-click on the Redstone Reader to open the gui, after which you have to insert a Variable Card into the Integer Redstone Value aspect, to bind the target’s redstone value to that Variable Card.
Next, place a Display Panel in the same network as the Redstone Reader, and insert your bound Variable Card to display it value.
As a next step, craft a Redstone Writer and let it write a maximal integer redstone value.
Logic Operations[edit | edit source]
While displaying values that originate from readers can be useful, things get really interesting when you start combining certain values with other values using Operators. All Operators can be found in the Logic Programmer.
Start by crafting a Logic Programmer, which exists in both item and block-form. Open its gui to see the list of all operators.
Next, search for the Integer operator, and click on it. This will open a window in which you should type a number. When you have done this, insert an empty Variable Card to bind that Integer to the Variable Card. When you’re done, do that once more for another Integer.
Finally, search for the Addition operator and open it. This allows you to add two Numbers. Insert your two Integer Variable Cards into these slots, and bind it to a new Variable Card.
As Integrated Dynamics evaluates variables in a lazy manner, this Addition Variable Card does not contain the addition of these Integers directly, but the addition will only be performed when the value is needed in the network, based on the variable references. For this, the network has to be able to find these referenced Variable Card. For this, you will need to craft and place a Variable Store. Insert the two Integer Variable Cards into this store to make them available to the network.
Finally, you can now connect a cable to the Variable Store, attach a Display Panel, and insert the Addition Variable Card to display the addition.
The Logic Programmer and Variable Stores are going to be your best friends when you want to do more complex automation.
Advanced Network Components[edit | edit source]
As you may remember, the Logic Programmer allows you to create variables with static values, or you can create more complex variables based on dynamic value evaluation.
The Materializer can be used for converting a dynamic value to a static one. This can be done by inserting the dynamic Variable Card in the top slot of the Materializer. Every Variable Card that is inserted into the left slot, will be set with the value the top variable has at that moment.
The Proxy allows you to add an extra level of indirection for your variables. You may for example have a logic program that requires a static value in there. If at any point in the future, you want to change that value, you would have to rewrite your program, unless that value was proxied, in which case you would simply have to update the value in the Proxy.
For this tutorial, create materialized and proxied Variable Cards.
Advanced Operations[edit | edit source]
As you may have noticed during the last tutorial, the Logic Programmer allows you to do way more than just adding numbers. In this tutorial, we’ll look into the more advanced datastructures and chaining of operators.
Let’s start by creating a static List of the Integers 1, 10 and 100, and visualize it in a Display Panel.
Items are one of the possible value types in this mod. Let’s make a static Item Variable Card, dynamically retrieve the mod name from that item, and visualize it in a Display Panel.
Remember that you’ll have to use a Variable Store to store your referenced variable.
For the final, part of this tutorial, we’ll combine dynamic variables with operators. Attach an Entity Reader to a network, read the target Entity, retrieve the Block the target Entity is looking at, and visualize that Block in a Display Panel.
The Value of Operators[edit | edit source]
In Integrated Dynamics, Operators are first-class citizens. Up until now, we have only used manually using the Logic Programmer, but in this tutorial, we’ll look into how they can be used in a more dynamic way, by storing Operators in Variable Cards, and invoking them dynamically.
As a first step, go to the Logic Programmer, and create a new static Operator, by starting to type Arithmetic Addition Operator in the autocomplete dropdown-list and clicking it, and write it to a Variable Card. After that, create two Integer variables. Next, find the Apply operator, and apply the first Integer to the Operator, which will bind the first input argument of the addition Operator to that Integer, and will output a new Operator with one remaining input argument. Next, use the Apply operator again to bind the final input argument of the newly created Operator. Finally, use a Display Panel to visualize your dynamically invoked addition.
Next to applying Operators, there are a lot of other advanced Operator operations. We’ll now look into using Operators on Lists, more specifically the Filter Operator that takes a List and a Predicate (an Operator with one input argument and a Boolean output value). Start by creating a List of the Integers 1, 10 and 100. Next, store the Relational Equals Operator in a variable. Next, apply this operator on the Integer 10. Next, use the Filter Operator with your List and the applied Operator. This will filter away all the items from the List that return False by applying them on the given operator, which in this case means that all elements that are not equal to 10 will be removed from the list. Visualize the result in a Display Panel.
There are plenty of other operations on Operators, such as combining Predicates, flipping Operator arguments, and more operations on Lists.