RFTools graphics programming from entry to pits RF tool: control (RFTools Control) Minecraft Game

This tutorial is set by the author to use the CC by-NC protocol.

introduce

-This tutorial is mainly for players who want to use graphical programming for logistics or synthetic control.

-You can use this module for automatic synthesis, storage judgment, items/fluid transmission, transmitting messages across dimensions, graphical interaction and other work.

The journey of thousands of miles begins with the foot

-If you see the "optional" remarks, I may explain it when needed.

Material preparation work

Programmer: Programming device, and write the program into the program card.See the program, please refer to the "program card placement area" in the programmer.

Program card: Storage and writing procedures.

Processor: Put the program card into the processor and run.

Core (CPU): The CPU is required for the processing program for the processor.Each event -type operation code thread occupies a CPU.

Network card (optional): When used to connect to synthetic stations or nodes, you need to use the network card to get the coordinates of these devices.

Mistasis (optional): Provides variables used to save data.

Multi -capacitive storage tank (optional): When performing a mortar operation, you need to place at least one multi -capacitive storage tank in the adjacent area of ​​the processor, and each multi -containment tank provides 4 streamlined index slots.

Graphics card (optional): module required during graphical operation.

Network logo (optional): Provide interactive support between the processor and processor to support cross -dimensional.

Basic concept

coordinate

-The programming area starts from the upper left corner and is arranged in [x, y]; the digital instructions in the figure below are in the [0,0] position.

- The "Y" axis is the larger the downward value, the more the two additional instructions in the figure below are in the [0, 1] position.

- The "X" axis is the greater the value of the right, the larger the number of instructions in the figure below is in the [1, 0] position.

-The purpose of coordinates: When the program is running or when writing an error, the error is displayed by "coordinate + abnormal name + processor core index".For example: [6, 2] Internet error (0)

Program enter the next step

-D double -click on any gray point of the four side of the operation code will become green, indicating that after the instruction is running, the next execution instruction will be in the green direction.When the next coordinates of the operating code do not have the operating code, the program stops automatically.

Return value

-Dyn operating code will have a return value.

-If you don't understand the programming language, then you only need to understand, you tell you two values ​​(such as "1" and "2"), and the calculator will tell you the operation results of these two values ​​(such as"1 + 2 = 3"), this is the return value.

-The program in the figure below is to output a string to the command line interface, which can help you understand the meaning of "return value".

The yellow operating code is a timer, which executes the program every other time.

The blue operating code is a string, which records a string, and then returns the recorded string.The returned string is handed over to the next operating code like a relay rod (whether the next operation code should be used, it has nothing to do with the string operation code).

The green operating code is a log information.Adjusting to the "Last_Str" mode, the content of the previous operation code is used, and converted into a string output to the command line.

Operating code

-Plebolic code is also called "instruction" or "OPCODES". It has the following categories:

Event type operation code: Event type operation code has at least one in the program, which represents the beginning of a program in the module.The program will start when the incident occurs. The event can be a redstone signal, a timer, an item synthesis request, etc.RF Tools | Control Manual Page 27.

The picture below is the redstone signal opening event operation code, which indicates that the processor executes the program after receiving the redstone signal.

Operation operation code: instructions used to perform standard operations. For example, if I want a processor to send a redstone signal in a certain direction, I need to use the operating redstone output instruction.

The following figure is the operating code of the redstone output operation. It indicates that when the program is executed to the instruction, the processor/node will send a redstone signal in the specified direction of the instruction.

The assignment operating code (optional): Generally, some calculations or inspections are made, and the results are submitted to the next operating code.For example, if I want to get the number of items in a container, I need to use the container reserves of the assigned container to calculate the instruction.RF Tools | Control Manual Page 28.

The figure below is read the redstone signal assignment operation code, which indicates that the redstone signal of the processor/node specifies the direction of the processor/node.

The assignment operating code will return the data it operates. For example, when reading the redstone signal operation code, an integer type represents the readings of the redstone signal.

Test operation code (optional): perform a Boolean value test and generate a branch in this test. Therefore, these operating codes have two outputs (green and red output).For example, if I want a processor to move items when the container A reserves is greater than the container B, it needs to be greater than the instruction.RF Tools | Control Manual Page 28.The figure below is greater than the test operation code. He said that when "V1> V2" is executed in the green direction instructions, otherwise the instruction of the red direction will be performed.

Configuration of instructions

-Dyn operating code will have instruction configuration, and you can use the direction and other settings to be used.When you place a operating code, click the operation code to display some buttons on the left side of the item bar. After clicking, you can open the specific function configuration interface of the instruction.Please refer to the instruction configuration description of the programmer.

You need to refer to the introduction settings in each instruction, to find the corresponding instructions through the super link or the game setting page in the encyclopedia to understand the configuration requirements. The program explanation generally explains only the operating logic.

The picture below is the configuration diagram of the redstone signal.Its configuration is the top of the detector (the first letter of the direction), and the program allows only one instance.

network

-Pilaterally, the player has learned how to build a network through the introduction of nodes, network cards, and processors.But here I will continue to be explained as readers.

The network needs to consist of a variety of modules/equipment such as network cards, nodes, processors, network logos, synthetic stations, but some modules/devices are not necessary.

A most basic network only requires processors, network cards, and nodes.

-In programming, generally we specify the container, or when the operation direction, there will be a "node name" attribute that allows the player to configure it. Here is the name of input nodes.

Step 1: Set up the network channel and node name at the node.(Enter string)

Step 2: At least there should be a network card at least there must be a network card in the module of the processor.

Step 3: Enter "Net Setup " in a processor with a network card to connect this network.( Represents the network channel.)

After executing this instruction, the processor will also obtain the synthetic station within the network card.At this time, the synthetic station can get the synthetic table in the workpan through the synthetic event instruction in the program.

For other parameters of the "Net" command, see the "2.5.1 net" article in the processor

At this point, a basic network is completed.

Ten driving in the horse, I am reluctant

1. Redstone output

"The little adventure that started."

-In anyway, output a redstone signal is always suitable for the beginning, as classic as "Hello Word".

-In required instructions: Hongshi signal is turned on, redstone output.

-Ar program explanation:

The processor opens the instruction of the redstone signal to detect the specified direction or the redstone signal of the direction or any direction.If there is a redstone signal in the specified direction, the program will enter the next step (you need to configure the output direction and output level in the redstone output).

Execute the redstone output instruction.It can be seen from the configuration diagram that the direction (SIDE) is the east of the processor, and the signal level is 12.In other words, the processor outputs a redstone signal with a level of 12 towards the east.

-In the upper right corner of the instructions just put down, a flashing red dot will be displayed. At this time, you need to configure the program. The following figure is the configuration chart of the redstone output:

Open the configuration GUI.

Specify an output direction.

-Ar program as shown below:

Second, redstone output is good afterwards

-When we finish the first step, we will find that the program has not stopped the output redstone signal after the program executes and outputs the redstone signal.At this time, we need to close the output of the redstone signal.

-Noch instructions: Wait.

-The program explanation: We add a delay of 80ticks to the first step, and then re -output the redstone signal. The redstone signal level output this time is set to 0.In this way, the processor has a button function, which will output a redstone signal with a signal level 0 after 4 seconds.

Third, items transmission

"Then, spring is here again."

-Neeping: Timing to detect items. If container A is greater than a certain amount, move to container B.

-In required instructions: timer, container reserve calculation, remove items, store items, greater than, connect.

-The processor index distribution: At least it must be assigned an object buffer index.For configuration, please refer to the processor buffer instructions.

-Ar program explanation:

Perform a program regularly through the timer instruction.

The container reserves calculation instruction calculation of the number of specific items in the container and return the calculation value.

V1 configuration is larger than the large instructions, select Last_number, and the V2 is set to 128.It means that if the value returned from the previous instruction is greater than 128, the instructions execute the green direction.

Take out the items and move the items of the container A to the processing object buffer, and then store it into the item instruction to move the items of the item buffer to the container B.

Back to the container reserves calculation through the connection instruction, the remaining reserves of the mobile item are calculated. If it is still greater than 128, it will continue to move, otherwise the instruction of the red direction will be executed.Because there is no next instruction in the red direction, the program stops automatically.Fourth, synthetic treatment

"The sky, the earth, the sun, the breeze, and a little rain drops"

-Net requirements: Specify a synthetic item through the synthetic station, and then automatically move the items in the program to the workbench for synthetic operations.

-In instructions:

Normal running process: synthesis, batch deposits into items, remove the materials, if, save the material into the workbench, remove the items, greater than, and the marking synthesis is successful.

Failure branch 1 (if the judgment instruction FALSE results branch): connect, wait.

Failure branch 2 (more than judgment instruction FALSE results branch): Label synthesis failure.

-D required module or device: synthetic station, workbench, synthetic card, network card, modular memory/box.

-The processor index distribution: The 0 -8 grooves of the processing device buffer are specified to place the material and the 9 grooves are placed in synthetic products.

-Ar program explanation:

The synthetic event operation code is only configured with a container that stores the synthetic card (generally configures the workbench directly, because the workbench needs to put a synthetic card).This instruction will allow the current program to load a ticket and a craftressult.

Save all the items of the 0-8 slot into the container.Prevent the material of the relics to occupy the material slot, resulting in partial materials that cannot be placed.

Take out the material with the materials according to the specified synthetic table. The "ITEM" configuration we set here is "F: Craftresult". The items are specified by the results of the synthetic table.

Determine whether the material is complete after moving, if the items are complete, return True.Through the "if" instruction judgment.If you are "true", execute the next instruction.Otherwise, the red "False" branch is executed.

4.1. "FALSE" branch: Wait a period of time, return to the "3" step to re -move the material and determine whether the material is complete.

If the instructions determine whether the material is complete, move the items in the processor to the workpanage according to the synthetic table.

Move the synthetic product to the "9" slot indexes in the processing device buffer area.

The number of movements is greater than the large instructions, and if it is greater than 0, it means successful synthesis.Less than 0 indicates the failure of synthesis, and the red "FALSE" branch is executed.

7.1. "FALSE" branch: The label synthesis failed, and the task synthesis submitted by the synthetic station failed, allowing the synthetic station to close this task display.The program is over.

The marking synthesis is successful, and the synthesis task submitted by the synthetic station has been completed, so that the synthetic station to close this task display.

Save all the items of the 0-9 grooves into the container to prevent the slot of the next synthetic task.The program is over.

5. Fluid treatment

-This is a simple program like item transmission. The difference is that it specifies the fluid slot index.For configuration, please refer to the processor's fluid area description.

-Neper: Moved the fluid in fluid container A to fluid container B.

-Medy module or equipment: multi -containment storage tank.

-In required instructions: The redstone signal is turned on, the fluid is removed, and the fluid is stored in the fluid.

-The processor index distribution: At least allocate a fluid groove index.

-Ar program explanation:

The redstone signal starts instructions and starts the program after receiving the redstone signal.

Take out the fluid instruction to move the fluid A of the fluid container A to the fluid slot index 0.(The first index of configuration is always 0)

Move the fluid in the fluid groove index 0 into the container B.

6. Use of variables/token

"Don't send me the way back"

-For variables and token are used to store data. Their instructions are set variables to write data into the mark.

-Set the variable and write the data to the two instructions of the data as the same effect. Both are written in the previous instruction return value to somewhere. The difference is that the mark is the form of the item, and the variable only exists in the processor.

-We their use: Sometimes our program may set a place where the data storage data is required for convenient configuration or avoiding back -value conflict.Then share them with other programs.

-Che application scenario: take the program in "Four: Synthetic Treatment" as an example.We can see that in this program we are equipped with containers that store materials three times and three times to store synthetic card containers.If we later change the production line, it is very inconvenient to re -configure it again.

-Caporic groove index distribution: The container that stores the material is written into the variable index 0, and the container that stores the synthetic card is written into the variable index 1.

-In the need for instructions: On the basis of the "Four: Synthetic Treatment" program, increase the read container and set up variables.

-D required module or device: memory barrier.

-Ar procedure explanation: No repeated places with "Four: Synthetic Treatment".

It can be seen from the program diagram that after the synthetic event instruction is executed, the program reads two containers first and adds variable slot indexes by setting variable instructions.

Then the later operating instructions, the part of the container can directly select the variable index mode.For example, the last instruction of synthetic processing: In the batch of the items, fill in "0" directly in the container parameter of the INV configuration.Seven, message & signal

"The four seasons are replaced, the rotation goes to recovery"

-Sh signal: Most of them work with the interactive screen module. A button is configured by the screen to send a signal, and then the processor receives the signal after receiving the signal.The signal sent by the program cannot be passed to other processors.

-Noch instructions: signal, log information.

-D required module or device: interactive screen module, screen, screen controller.

-Ar program explanation:

The interactive screen module binds the processor using the program, and then the interactive screen module configures a button to send a signal.

The signal name of the signal event instruction configuration is "AAAA". When the interactive screen module emits the signal "AAAA", the execution program is executed.

The log information instruction outputs a string in the console to indicate that the program is executed normally.

- information:

After receiving the message from other programs, execute the program.

The message can send messages across dimensions to other processors.

Need to be used with network identification.

-In instructions: Message, sending messages, signals, waiting, log information.

-D required module or device: network identification, interactive screen module, screen, screen controller.

-Ar program explanation: For convenience, I all write in the same processor.

After receiving the signal from the interactive screen module, the processor sends a message.

After receiving the message, the message instruction is delayed to send string to the command line interface to indicate that the program runs normally.

Eight, lock

-Lock: This instruction is used in multi -threaded conditions. When the processor runs multiple programs at the same time, it may operate the same variable or the same buffer at the same time. In orderThe problem exists.

Unlock commands cannot be used for locks of different threads.In other words, an event type instruction uses a lock, and the program must be unlocked after running, otherwise other programs cannot use the lock.

-Esmorate instructions: locking, unlocking.

-Ar program explanation:

After the A program is executed, the lock is performed. After a delay of 5 seconds, 233 string is sent.

Program B runs when the A program is run. At this time, the B program will enter the wait because the A program is using the same lock.

When the A program is unlocked, the B program can use the lock and execute the program.The B program emits the "Redstone!" String.

⑨, abnormal

"Read with me: you will make a mistake!"

-Exception: This instruction will capture errors and execute programs when the processor executes the process.For example: Specify the occasion of nodes that do not exist: "Missing_node" is abnormal.

-Deeping instructions: abnormal.

-Ar program explanation:

The program of A program card tries to read a redstone signal called "BBA" node.However, there is no such node in the network. When the instructions that are not captured without capturing this abnormality, the processor shows the red letter to tell the player what abnormalities have occurred.

Because the B program card captures the "missing_node" abnormality, the processor will not have a red letter.

After the abnormal instruction captures the "missing_node" abnormality, a string "NO! Node!" Is issued.

grateful

YouTube user: "Direwolf20" Mod Spotlight RFTOOLS Control PT1 ~ 3.

MCMOD user: CRAFTKURO (UUID: 68394) supplementary instruction information.