Colobot Wiki

When you define a variable, you must give two elements:

  1. a name
  2. a type

Once you defined a variable, you can use it to put information in it. However, the information that a variable can contain must always be of the correct type: a variable of type float can not contain a string, etc. In a program, the name of a type is always written on green background. If the name of a type is not colored, this means that the name is misspelled. Type names are always written with lower case characters.

List of all variable types:[]

  • int - For a whole number (12, -500, etc.).
  • float - For a real number (12, 3.14, 0.2, -99.98, etc.).
  • bool - For a boolean variable, that can only take the values true or false.
  • string - For texts ("Hello!", "No object found", etc.)
  • point - For the coordinates of a point in space; a variable of this type consists of three parts named x, y and z.
  • object - A variable of this type contains the information about an object (bot, building, enemy, etc.).
  • void - This type is an "empty type", that you use when you do not want to specify a type.

See also[]

CBOT Language and categories.