DumbBots.NET Basic Coder

 

To get started with the Basic Coder, let’s first add an “IF Block”.

An “IF Block” is something used in programming to determine which code runs next. Take the following example:

 

IF            Bob is hungry

THEN

                Bob will eat something

ELSE

                Bob will not eat something

 

In the above example, Bob will eat something if he is hungry. Otherwise he will not eat something. Simple?

 

To add our “IF Block”, click and drag the command to the window. It should look like the screenshot below:

 

 

Our “IF Block” needs a condition to check. In our example we will check if the enemy is sighted.

So drag the “Get Enemy Sighted” command onto the square next to the “IF” text.

See screenshot below:

 

“Get Enemy Sighted” returns “Yes” or “No”, depending on whether the enemy is visible to the player.

Our condition will be whether “Get Enemy Sighted” returned “Yes”, so make sure “Equal to” is selected, and click the “Yes” button.

 

Now our condition is set, so it’s time to tell the program what to do if the enemy IS visible.

Drag the ‘Shoot Bullet’ command to the “THEN” block.

 

Dragging the command has caused a popup to open. This popup is telling us that the command needs more information.

This command needs to know WHERE to shoot, so let’s choose “Get Enemy Position” as the position to fire at.

 

If the enemy is not visible, let’s move around.

Drag the “Move to Random Location” command to the “ELSE” block.

 

We can add more than one command to a block. So let’s also say something while we’re looking around.

Drag the “Say Text” command to below the “Move to Random Location” command.

 

This command needs some manual data entry. Enter the string we want to say and click the “OK” button.

 

The following screen shows our finished work.

Now all that remains is to click “Generate code” at the top. Then paste the result in the DumbBots.NET code editor and click “Update Team 1”