Standard functions

Standard functions

> Tutorial

A function is used to perform a task such as a calculation or an action. It takes arguments as input, executes instructions and can return a result.

In our current code, we use the following functions:

The documentation

There are more than 300 standard functions in LeekScript, they are grouped together on one page: the documentation. To access it, go to the Help tab, then click on Documentation.

It is possible to open the documentation from any page with the shortcut Ctrl + Alt + H. Try it now!

The description of a function provides you with the following information:

Using chips

Now that we are familiar with the standard functions, we are going to use a little more in our AI!

A chip is a battle-ready power that can be used to heal, protect, boost, attack, and more. To use it, you must first equip it on your leek:

Then, use the useChip(chip) function to launch a chip. Unlike weapons, there is no need to equip them first.

Purchase the Bandage, Motivation, Protein, and Helmet chips and equip them on your leek.

We will use them all at the start of our turn, adding the following code after equipping our weapon:

CHIP_MOTIVATION, CHIP_PROTEIN are, like WEAPON_PISTOL, constants representing the chip or the weapon which one wishes to use. Predefined value constants that are listed in the documentation as functions.

❓ Quiz

What can a function do?

Calculate and return a value Perform an action or instructions Do not return a value Take multiple parameters

Full AI