---
url: /flow/guide/scripting-reference/scripts.md
---

# Scripts

Scripts are the code that you provide and attach to an Event (Refer [Events](/flow/guide/scripting-reference/events/)). A script has an initial skeleton that is provided by the script engine. You enter your script code within this skeleton. The following is a typical script skeleton.

```pascal
procedure ScriptEvent (var Value : variant);
begin

end;
```

::: danger
The first line indicates the name of the script and under all circumstances must not be changed.
:::

### Inputting script code

The second and fourth line are the `begin..end` block (Refer[Statements](/flow/guide/scripting-reference/statements/)) within which you should enter your script. You must not remove this begin...end block. The following is an example of script code being entered - this code adds an entry to the logs during execution of the map.

```pascal
procedure ScriptEvent (var Value : variant);
begin
loginfo('I want to add this text to the log');
end;
```

### Declaring variables

Variables can be declared between the first and second lines. Create a new line directly after the first line and enter your variable declarations. For more information on variables and how to declare them refer to [Variables](/flow/guide/scripting-reference/variables/). The following is an example of a Integer variable being declared. The variable name is `MyVariable`

```pascal
procedure ScriptEvent (var Value : variant);
var MyVariable : Integer
begin

end;
```

::: tip
Variable names are not case sensitive in a script. If you declare as `MyVariable` you can reference it is `myvariable`
:::
