Difference between revisions of "HPL2/ScriptReference"

From Frictional Wiki
Jump to navigation Jump to search
m (Darkfire moved page Hpl2:Amnesia:script language reference and guide:script language reference and guide to HPL2/ScriptReference without leaving a redirect: Terribly long link)
(→‎Articles: Link updates)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Entry pages]]
 
= Script Language Reference and Guide =
 
= Script Language Reference and Guide =
  
 +
This section will explain the features of [http://www.angelcode.com/angelscript/ 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 [[HPL2|HPL2 engine]]. This is the fundamental knowledge that will help you understand how map scripting for Amnesia works. This guide is intended to teach you ''scripting (programming)'', and to be used as a reference to the ''features'' and the ''rules'' of the script language itself. It is ''not'' meant to teach you how to accomplish specific tasks in your custom stories and full conversions for Amnesia (although you might end up learning a few things about that as well).
  
This section will explain the features of [http://www.angelcode.com/angelscript/|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 [[hpl2:start HPL2 engine]. This is the fundamental knowledge that will help you understand how map scripting for Amnesia works. This guide is intended to teach you ''scripting (programming)'', and to be used as a reference to the ''features'' and the ''rules'' of the script language itself. It is ''not'' meant to teach you how to accomplish specific tasks in your custom stories and full conversions for Amnesia (although you might end up learning a few things about that as well).
+
If you are just starting out, you'll probably want to go through the topics in the order listed here. If you feel more comfortable with the scripting language, you can jump right to any page you want. Each topic assumes you're familiar (at lest to some extent) with the topics that come before it in this list.
  
The guide doesn't make any assumptions about your previous scripting or programming experience. If you are just starting out, you'll probably want to go through the topics in the order listed here. If you feel more comfortable with the scripting language, you can jump right to any page you want. Each topic assumes you're familiar (at lest to some extent) with the topics that come before it in this list. In the wiki tree on the left, the topics are listed alphabetically, for easy reference.
+
Every topic begins with the "At a Glance" section, which is intended to be used as a quick remainder, a "cheat-sheet" of sorts; if you're new to the topic, you can skip to the "Discussion" section which follows immediately.
  
Every topic begins with the "At a Glance" section, which is intended to be used as a quick remainder, a "cheat-sheat" of sorts; if you're new to the topic, you can skip to the "Discussion" section which follows immediately.
+
==Articles==
 +
* '''[[HPL2/ScriptReference/Quick Start|Quick Start]]''' - a quick introduction to map scripting
 +
* '''[[HPL2/ScriptReference/Execution Flow|Execution Flow]]''' - explains how program flow is transfered from the game to the script engine, and vice versa
 +
* '''[[HPL2/ScriptReference/Variables|Variables]]''' - explains what variables are and how to use them
 +
* '''[[HPL2/ScriptReference/Types|Types]]''' - discusses various types supported by the script language
 +
* '''[[HPL2/ScriptReference/Constants And Enumerations|Constants and Enumerations]]''' - explains how to define constant values
 +
* '''[[HPL2/ScriptReference/Functions Part 1|Functions - Part 1: The Basics]]''' - explains the basics of functions, and how to create them and use them
 +
* '''[[HPL2/ScriptReference/Control flow - Conditional Statements|Control Flow - Part 1: Conditional Statements]]''' - explains if, if-else, and switch statements, which are used to make decisions
 +
* '''[[HPL2/ScriptReference/Control flow - Loops|Control Flow - Part 2: Loops]]''' - discusses while, do-while and for loops
 +
* '''[[HPL2/ScriptReference/Functions Part 2|Functions - Part 2: Beyond the Basics]]''' - explains const-parameters, function overloading and function wrapping
 +
* '''[[HPL2/ScriptReference/Functions Part 3|Functions - Part 3: Digging Deeper]]''' - explains passing by reference, using callbacks and using funcdefs
  
<note important>This is work in progress. Some of the information is currently missing. You are welcome to contribute, but please try to follow the format used throughout.</note>
+
{{todo|What follows is a short list of topics which wait to be documented:}}
 
+
* '''Arrays''' - array types in detail
The following subsections are available:
+
*'''Object oriented programming''' - classes, composition, inheritance, polymorphism
* '''[[hpl2:amnesia:script_language_reference_and_guide:execution_flow|Execution Flow]]''' - explains how program flow is transfered from the game to the script engine, and vice versa,
+
*'''Debugging''' - a brief overview of common mistakes and of debugging ideas
* '''[[hpl2:amnesia:script_language_reference_and_guide:quick_start|Quick Start]]''' - a quick introduction to map scripting,
+
*'''Sandbox Maps''' - simple maps to help you learn.
* '''[[hpl2:amnesia:script_language_reference_and_guide:variables|Variables]]''' - explains what variables are and how to use them.
 
* '''[[hpl2:amnesia:script_language_reference_and_guide:types|Types]]''' - discusses various types supported by the script language.
 
* '''[[hpl2:amnesia:script_language_reference_and_guide:constants_and_enumerations|Constants and Enumerations]]''' - explains how to define constant values.
 
* '''[[hpl2:amnesia:script_language_reference_and_guide:funcions_-_part_1|Functions - Part 1: The Basics]]''' - explains the basics of functions, and how to create them and use them.
 
* '''[[hpl2:amnesia:script_language_reference_and_guide:control_flow_-_conditional_statements|Control Flow - Part 1: Conditional Statements]]''' - explains if, if-else, and switch statements, which are used to make decisions.
 
* '''[[hpl2:amnesia:script_language_reference_and_guide:control_flow_-_loops|Control Flow - Part 2: Loops]]''' - discusses while, do-while and for loops.
 
* '''Arrays''' - array types in detail.
 
* '''[[hpl2:amnesia:script_language_reference_and_guide:funcions_-_part_2|Functions - Part 2: Beyond the Basics]]''' - explains const-parameters, function overloading and function wrapping.
 
* '''[[hpl2:amnesia:script_language_reference_and_guide:functions_-_part_3|Functions - Part 3: Digging Deeper]]''' - explains passing by reference, using callbacks and using funcdefs.
 
* etc... (--> advanced stuff: classes, composition, inheritance, polymorphism)
 
* etc... (--> a brief overview of common mistakes and of debugging, maybe a few more things)
 
* '''Sandbox Map(s?)''' - a simple map (or maps, haven't decided yet...) to help you learn.
 

Latest revision as of 14:16, 5 August 2020

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 HPL2 engine. This is the fundamental knowledge that will help you understand how map scripting for Amnesia works. This guide is intended to teach you scripting (programming), and to be used as a reference to the features and the rules of the script language itself. It is not meant to teach you how to accomplish specific tasks in your custom stories and full conversions for Amnesia (although you might end up learning a few things about that as well).

If you are just starting out, you'll probably want to go through the topics in the order listed here. If you feel more comfortable with the scripting language, you can jump right to any page you want. Each topic assumes you're familiar (at lest to some extent) with the topics that come before it in this list.

Every topic begins with the "At a Glance" section, which is intended to be used as a quick remainder, a "cheat-sheet" of sorts; if you're new to the topic, you can skip to the "Discussion" section which follows immediately.

Articles

To do: What follows is a short list of topics which wait to be documented:

  • Arrays - array types in detail
  • Object oriented programming - classes, composition, inheritance, polymorphism
  • Debugging - a brief overview of common mistakes and of debugging ideas
  • Sandbox Maps - simple maps to help you learn.