UiBot : Robots for Everyone!
Read this section when you need to add judgments to your flow chart or to transfer data between multiple process blocks. You can use variables in flowcharts as well. Variables whose scope of action is limited to the current process are “in the flow.” There is no direct use in the process block.
When a process block starts to run, a value (which can be a variable or an expression) can be inputted into the process block. When a process block ends, a value can also be outputted to a variable in the flow chart. You can also add a judgment to the flow chart to determine which path to run after, depending on a certain value.
In the flow chart, select a process block with the left mouse button. The properties of the process block will appear in the "Properties" column on the right. This column contains two items, “input” and “output,” as shown in the left figure below. If you need to pass data into a process block, fill in the input column (variables, expressions, etc.) and use a special variable Self.Input into the process block which will automatically store all of the input values. If you need to send data from a process block to the “Properties” column, you just need to write
Return < Output Value>
into the process block and fill in a variable name in the "Properties" column of the flow chart to save the output value in the variable. UiBot's programming language is case-insensitive to keywords and variable names, so you can also write SELF.INPUT, self.input, or RETURN Output Value, etc.
Property Bar of Flow Chart
Similarly, you can use the judgment element in the flow chart by dragging it into the flowchart and selecting it with the left mouse button. Then you can see the attributes of the element in the attribute bar. As shown in the right figure above. The "Conditional Expressions" column is the key. You can fill in a variable or expression. When the process runs this judgement, it will be determined whether the value of the variable or expression is true or not to follow the arrow shown by “Yes” or the arrow shown by “No.”
As shown in the figure below, the "judgment" element has two arrows, one marked “Yes” and the other marked “No.” When the "Conditional Expression" in its attribute is true, it runs backwards along the “Yes” arrow, otherwise it runs backwards along the “No” arrow.
Determining the Process Based on Conditional Expressions
Next, we will illustrate the specific use of the flow chart input and output functions. Suppose there is a flow chart with two process blocks named "process block 1" and "process block 2". We let "process block 1" run first, and "process block 2" run afterwards, as shown in the following figure. We hope that "process block 1" can get the current system time, convert it to string format, and output it to "process block 2,” allowing 23 "process block 2" to display the output of "process block 1" in UiBot’s Creator in the form of debugging information.
Two Sequential Process Blocks
We first select "process block 1" and fill in a variable name in its "output" attribute, assuming variable X. Next, we select "process block 2" and fill in the same variable name (case-insensitive) in its "input" attribute. In this way, through variable X, the output of "process block 1" and the input of "process block 2" are connected as shown in the figure below. This variable X is only valid in the current flow chart, and its function is simply to connect the two process blocks. In both process block 1 and process block 2, X cannot be used directly to set or obtain its value.
Connecting the Output of Process Block 1 with the Input of Process Block 2 Through the Same Variable
How can we make process block 1’s output process block 2’s input?
First, you click on the "paper and pen” icon to enter process block 1. Then insert a "get system time" and a "format time" command (under the "time" classification), and set the "time" attribute of "format time" as the result of "get system time", then we can get the current time and accommodate it.
Next, insert a "Jump Out and Return" command (under the lexical classification) and set sRet as the return value so that process block 1 can output correctly as shown in the figure below. In order to facilitate the reader's understanding, the Visual View and Source Code View of the process block are listed in the diagram, and the reader can choose one of them according to the degree of mastery.
Output the Current Time in Process Block 1
After that, click on the "paper and pen" icon to enter the process block 2. Just insert a command "Output Debugging Information" and set the "Output Content" attribute to Self. Input (case-insensitive) as shown in the figure below. Similarly, we also list the Visual View and Source View of the process block for simplicity.
Output Debugging Information in Process Block 2 from Process Block 1
Go back to the flow chart interface and click the "Run" button; you can then see the results of the operation. Note that since process block 2 needs to get the output of process block 1, the results in the flow chart are correct. Although process block 2 can also run independently, the results may differ due to the lack of output from process block 1 when running independently.