Toggle search
Search
Toggle menu
Toggle personal menu
Editing
Instructions Step By Step
(section)
From Desynced Wiki
Read
Edit
Edit source
View history
Page
Discussion
More actions
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Loops and Flow === A Loop is a way of repeating a set of commands for a certain amount of times you can build a loop out of multiple instructions and tethers looping back onto themselves, but in this case we're referring specifically Loop type instructions located within the Flow category in the menu of instructions. These nodes have two outgoing nodes one unlabeled and one labeled as done along with s single out put for a datatype. What happens when they are used is it will step through repeatedly each time pushing an datatype out and flowing through the top outgoing tether point as long as the tether connects to another instruction it will continues that chain until the tethers stop or it hits the Break instruction. If the tethers are not connected it won't go to Program Start but stop and go to the next thing in the loop and repeat the same process. When there are no more things in the loop it will go through the tether node labeled 'Done.' ==== Example:Items on the Ground ==== <code>DSC8a2cbIPg0tMiaP3Z9WGe2EXWf838Ju6f0FnIKA1Wa5Rc3qW3gf2RP5AG10aeTo0jmU2a1hbLuO398Hmo4SiEN84ZZFpH27JgIS0Ow39N4ZZNhp1u4IYQ2F9AJW4YugqN0OIqU92xQGJQ4UENsP3WJO802Rfdxr0byKUf303d9Z22YUrO2zqPSO0NP4nO0eyehz1HaKCA1GN10z0qKlnv02aUit07hr3C3AbeEo06v7Rn2luLso27qWNe1mkYDF3uia7f2YLBq31Rl8Ps120zNF0dpymG3MqJ120SbVr50xyr8p3qEc9Z23bjd222qCAv1WcESI0gnq</code> ===== Copy ===== In the above example the Copy Instruction is used to initialize the parameter to zero. Copy takes data and copies it to an output usually a variable/parameter/register. In this case it looks like we're not copying anything but but even an empty field in Desynced is something, empty is actually a null data type coupled with zero, and since were about to count things we want a zero to add to. ===== Loop Entities(Range) ===== This is used to look for things within your units visual range (default is 15) and uses filters to narrow what your looking for. In this case the only filter used is dropped items this will look for items on the ground and piles of resources as well. For this loop you also need to set the range it's looking for you can set it as high as you want but it will only be able to see as far as the unit can which without other modules is 15, however you can set it a shorter range and it will limit what it returns. If you don't set it remember it's not nothing it acts as zero (range) so you will get no returns. For every item it finds it will output an entity (not a data type but a set of data types) into the variable 'A' and then flow to the next instruction through the upper tether node. ===== Add ===== Add does exactly what it sounds like it adds one number to another number. You can use math functions on most data types maybe all due to them all having a number component. However math functions can behave differently when dealing with location data types. ===== Wait ===== Wait is only here to make it easier to see the count going up it set to wait 4 ticks there are 5 ticks in a second so it will wait each count one second before going into the next loop item. ===== Redo Loop ===== No more connections so outside of a loop it would go to Program start but since it's considered in a loop it will not restart but go to the next step in that loop. ===== End Loop ===== Once it has counted all dropped items in range it will go through the "Done" tether node. ===== Exit ===== If we wanted this behavior to constantly run we would not connect this tether to anything and it would go back to the beginning but in this case we want to only run once to do that the Exit instruction will stop the behavior running. Note: if testing this behavior make sure there is something on the ground of it will not seem to work.
Summary:
Please note that all contributions to Desynced Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Desynced Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)