Skip to content
Rubens de Oliveira Moraes Filho edited this page Apr 29, 2021 · 3 revisions

This command sends free units of a specific type near to the position x, y, on the map. The units will try to reach the cell given by the coordinates, if this cell doesn’t have other units on it, otherwise, they will try to reach any adjacent cell.

Stand-alone application

MovetoCoord is a simple command used to send a specific unit, defined by the parameter <type>, to coordinates (<x-coordinate>,<y-coordinate>) defined previously. MovetoCoord can be interpreted (composed) as:

moveToCoord(<type>,<x-coordinate>,<y-coordinate>)

In commands like that, when you need to define coordinates, keep in mind how the coordinates are defined in the MicroRTS. The picture below shows an example in a map of size 8x8.

Coordinates

Used in a Loop (For)

MovetoCoord can be used inside of the for structure by adding a <unit> parameter into the parameter list. It changes the command like the example below:

moveToCoord(<type>,<x-coordinate>,<y-coordinate>,<unit>)

When moveToCoord receives a <unit> as a parameter, the command will try to use the specified unit and the command will try to move this unit to the (<x-coordinate>,<y-coordinate>).


In code (how to creat one)

CommandDSL ast_example = new CommandDSL("moveToCoord(Worker,1,1)");

By translate method

ast_example.translate() --> print in Java console--> moveToCoord(Worker,1,1)

By friendly translate method

ast_example.friendly_translate() --> print in Java console--> moveToCoord(Worker,1,1)

By formated Structured DSL Tree Pre-Order Print method

BuilderDSLTreeSingleton.formatedStructuredDSLTreePreOrderPrint((iNodeDSLTree) ast_example); --> print in Java console--> c->moveToCoord(Worker,1,1)

Clone this wiki locally