Difference between revisions of "Custom labels"
From WikiManual
(→Custom Labels) |
|||
(8 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Darwinbots allows you to define '''custom variables''' at the start of your DNA that work exactly like [[sysvar]]s in syntax. | |
− | + | ||
− | + | == Use == | |
At the start of your DNA, add | At the start of your DNA, add | ||
Line 19: | Line 19: | ||
will allow you to address .myidcode as a number, allowing you to quickly modify constants (in this case conspecific recognition probably) in your DNA code. | will allow you to address .myidcode as a number, allowing you to quickly modify constants (in this case conspecific recognition probably) in your DNA code. | ||
+ | |||
==How the DNA works== | ==How the DNA works== | ||
* [[Genes]] | * [[Genes]] | ||
* [[Execution Flag]] | * [[Execution Flag]] | ||
− | * [[ | + | * The [[Stack]] |
* [[Custom labels]] (or variables if you prefer) | * [[Custom labels]] (or variables if you prefer) | ||
+ | * [[Robot DNA]] | ||
+ | |||
+ | ==Available Variables== | ||
+ | * [[Free Variables]] | ||
+ | |||
+ | [[Category:Reference manual]] |
Latest revision as of 12:19, 20 June 2015
Darwinbots allows you to define custom variables at the start of your DNA that work exactly like sysvars in syntax.
Use
At the start of your DNA, add
def varname number
Where varname is the name you want to attach to your label (variable) and number is the number you want to associate with this label.
For instance, to add a custom variable to store color, add
def color 50
You can now address *.color and .color within your DNA and the program will understand what you mean.
Note that this also works to create constants. For instance,
def myidcode 12566
will allow you to address .myidcode as a number, allowing you to quickly modify constants (in this case conspecific recognition probably) in your DNA code.
How the DNA works
- Genes
- Execution Flag
- The Stack
- Custom labels (or variables if you prefer)
- Robot DNA