Goto http://www.stucuk.netGoto http://www.atlanticaonlinewiki.comGoto http://www.game-requirements.com

Functions

From Original War Support Wiki

Jump to: navigation, search

Tutorials -> Functions

Contents

Info

Your own functions act similar to variables. They are defined using 'function' command (or 'export function' to be able to use it in all modules):

function myfunction;
begin
//here comes the code
end;

You can define some variables in functions:

function myfunction;
var myvariable;
begin
//here comes the code
end;

They can also have parameters:

function myfunction(parameter1,parameter2);
var myvariable;
begin
//here comes the code
end;

Example function with parameters

export function KillAndWin(unit);
begin
KillUnit(unit);
YouWin;
end;

in any SAIL code:

KillAndWin(enemy);

Unit with 'enemy' identifier will be killed and you will win.

Some notes

1) Function's name cannot be the same as the name of any variable.

Personal tools
Clanbase