<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="https://oldwiki.frictionalgames.com/lib/exe/css.php?s=feed" type="text/css"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Frictional Game Wiki hpl2:amnesia:script_language_reference_and_guide</title>
    <subtitle></subtitle>
    <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/"/>
    <id>https://oldwiki.frictionalgames.com/</id>
    <updated>2026-04-23T08:46:15+00:00</updated>
    <generator>FeedCreator 1.7.2-ppt DokuWiki</generator>
<link rel="self" type="application/atom+xml" href="https://oldwiki.frictionalgames.com/feed.php" />
    <entry>
        <title>Constants and Enumerations</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/constants_and_enumerations?rev=1444165617&amp;do=diff"/>
        <published>2015-10-06T21:06:57+00:00</published>
        <updated>2015-10-06T21:06:57+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/constants_and_enumerations?rev=1444165617&amp;do=diff</id>
        <summary>Constants and Enumerations

----------

At a Glance

Constants and enumerations allow you to define names which refer to values that should never change during the execution of a script.

Constants

// Some math constants:
const float PI = 3.1415926f;
const float E = 2.7182818f;

// Integer constants:
// The constants in this example define when should collision events take place;
// intended to be used with the AddEntityCollideCallback() engine function

const int COLLIDE_ON_ENTER = 1;
const in…</summary>
    </entry>
    <entry>
        <title>Control Flow - Part1: Conditional Statements</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/control_flow_-_conditional_statements?rev=1357229754&amp;do=diff"/>
        <published>2013-01-03T16:15:54+00:00</published>
        <updated>2013-01-03T16:15:54+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/control_flow_-_conditional_statements?rev=1357229754&amp;do=diff</id>
        <summary>Control Flow - Part1: Conditional Statements

----------

At a Glance

The If-Statement

Syntax:


if(condition)
{
    // things to do
}


Or:


if(condition)
{
    // things to do if condition is TRUE
}
else
{
    // things to do if condition is FALSE
}</summary>
    </entry>
    <entry>
        <title>Control Flow - Part2: Loops</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/control_flow_-_loops?rev=1434450287&amp;do=diff"/>
        <published>2015-06-16T10:24:47+00:00</published>
        <updated>2015-06-16T10:24:47+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/control_flow_-_loops?rev=1434450287&amp;do=diff</id>
        <summary>Control Flow - Part2: Loops

At a Glance


// The While-Loop
while(sum &lt;= 100)
{
    // This code will be repeatedly executed as long as sum &lt;= 100, 
    // if that condition was satisfied to begin with.
    // If not, the whole code block will be skipped.
    sum = (sum * 2) + 1;
}


// The Do-While Loop:
do
{
    sum = (sum * 2) + 1;    // executed AT LEAST ONCE, since
    
} while(sum &lt;= 100);        // the condition is evaluated at the end


// The For-Loop:
for(int i = 0; i &lt; 10; ++i)
{
   …</summary>
    </entry>
    <entry>
        <title>Execution Flow</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/execution_flow?rev=1356126717&amp;do=diff"/>
        <published>2012-12-21T21:51:57+00:00</published>
        <updated>2012-12-21T21:51:57+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/execution_flow?rev=1356126717&amp;do=diff</id>
        <summary>Execution Flow

This section describes at which points in time the game engine transfers execution to and from the user-supplied script functions.

The game itself is executed by the system running the game engine code, that is, the binary game code written by the developers, and embedded inside the game's executable files. Amnesia supports scripting by allowing you to associate each level with a corresponding script file (</summary>
    </entry>
    <entry>
        <title>Functions - Part 1: The Basics</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/funcions_-_part_1?rev=1358194619&amp;do=diff"/>
        <published>2013-01-14T20:16:59+00:00</published>
        <updated>2013-01-14T20:16:59+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/funcions_-_part_1?rev=1358194619&amp;do=diff</id>
        <summary>Functions - Part 1: The Basics

----------

At a Glance

Syntax:

returnType FunctionName(parameter_list)
{
    // function body goes here
}

Where returnType is a name of a type, or void if the function doesn't return a value, 

and where (parameter_list</summary>
    </entry>
    <entry>
        <title>Functions - Part 2: Beyond the Basics</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/funcions_-_part_2?rev=1358194592&amp;do=diff"/>
        <published>2013-01-14T20:16:32+00:00</published>
        <updated>2013-01-14T20:16:32+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/funcions_-_part_2?rev=1358194592&amp;do=diff</id>
        <summary>Functions - Part 2: Beyond the Basics

----------

At a Glance

Const-Parameters


void ConstParamFunc(const int val1, int val2)
{
    val1++;  // ERROR: Changing the value of a const parameter is not allowed!
    val2++;  // OK.
}


Function Overloading &amp; Wrapping</summary>
    </entry>
    <entry>
        <title>Functions - Part 3: Digging Deeper</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/functions_-_part_3?rev=1364436344&amp;do=diff"/>
        <published>2013-03-28T02:05:44+00:00</published>
        <updated>2013-03-28T02:05:44+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/functions_-_part_3?rev=1364436344&amp;do=diff</id>
        <summary>Functions - Part 3: Digging Deeper

----------

At a Glance

Passing by Value vs Passing by Reference




	*  Value types (all fundamental types, except string) 
	*  Reference types (strings, arrays, and classes)



Passing by Value


// Reminder: passing by value
int Double(int input)  // 'input' contains a copy of the original value
{
    input = input * 2;   // This is not enough, as 'input' is a copy
                             
    return input;        // The caller must get the new value …</summary>
    </entry>
    <entry>
        <title>Quick Start</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/quick_start?rev=1375996868&amp;do=diff"/>
        <published>2013-08-08T21:21:08+00:00</published>
        <updated>2013-08-08T21:21:08+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/quick_start?rev=1375996868&amp;do=diff</id>
        <summary>Quick Start

Introduction

Amnesia allows you to associate a script file with your map; from within this script file, you can control various aspects of the gameplay for your level. To connect the level with the appropriate script file, he engine relies on a naming convention: the script file is expected to have the same name as the map file, but the exstension should be hps.</summary>
    </entry>
    <entry>
        <title>Script Language Reference and Guide</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/script_language_reference_and_guide?rev=1358195730&amp;do=diff"/>
        <published>2013-01-14T20:35:30+00:00</published>
        <updated>2013-01-14T20:35:30+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/script_language_reference_and_guide?rev=1358195730&amp;do=diff</id>
        <summary>Script Language Reference and Guide

This section will explain the features of AngelScript, the script language used by Amnesia (the syntax, data types, variables, functions, control flow statements, OOP support, etc.), and provide a guide on how to use these features in the context of the</summary>
    </entry>
    <entry>
        <title>Types</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/types?rev=1357222738&amp;do=diff"/>
        <published>2013-01-03T14:18:58+00:00</published>
        <updated>2013-01-03T14:18:58+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/types?rev=1357222738&amp;do=diff</id>
        <summary>Types

At a Glance

// Commonly Used
int a = 0;		// integer
float b = 3.14f;	// floating point

bool c = true;		// Boolean (true/false)
bool d = false;

string e = &quot;Amnesia&quot;;	// string

/////////////////////////////////////////////////////////////
// Signed Integer Types
int8 f = -2;		// -128 to 127
int16 g = 5;		// -32,768 to 32,767
int h = 100;		// -2,147,483,648 to 2,147,483,647
int64 i = 8;		// -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

// Unsigned Integer Types
uint8 j = 255;	…</summary>
    </entry>
    <entry>
        <title>Variables</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/variables?rev=1356831854&amp;do=diff"/>
        <published>2012-12-30T01:44:14+00:00</published>
        <updated>2012-12-30T01:44:14+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/variables?rev=1356831854&amp;do=diff</id>
        <summary>Variables

At a Glance

int x;
int a, b;
int c = 2, d;
float pi = 3.14f;
bool isAmnesiaTheBest = true;
string subtitle = &quot;The Dark Descent&quot;;

Discussion

The concept of variables is pretty much the same as used in math – a variable is something that can take on a number of different values. To be more precise, variables represent a scripter-friendly way to access locations in computer's memory – because we scripters are humans, it is easier for us to declare a variable with a meaningful, human-r…</summary>
    </entry>
</feed>
