This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
script:reference [2019-11-19 18:08] – [Using Doomsday Script] skyjake | script:reference [2020-11-12 15:29] (current) – skyjake | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Doomsday Script reference guide ====== | ||
+ | |||
+ | This article describes the Doomsday Script language and its role in [[:Doomsday 2]]. | ||
+ | |||
+ | ===== Overview ===== | ||
+ | |||
+ | Doomsday Script is a scripting language with features such as a class-based object system, and exceptions. It is designed to harmoniously work together with Doomsday' | ||
+ | |||
+ | Scripting is used for several things internally, for example managing engine configuration and controlling [[assets: | ||
+ | |||
+ | Below is an example of the syntax: | ||
+ | |||
+ | def exampleFunc(a) | ||
+ | if a | ||
+ | return "It is true!" | ||
+ | else | ||
+ | return "Nay, it is false." | ||
+ | end | ||
+ | end | ||
+ | print exampleFunc(True) | ||
+ | |||
+ | |||
+ | The syntax is heavily influenced by Python and Ruby, with a few notable differences: | ||
+ | |||
+ | * Unlike Python, the amount of indentation whitespace has no special meaning. | ||
+ | * Compounds are explicitly closed with '' | ||
+ | * A colon ('':'' | ||
+ | * Objects are weakly typed: they may have one or more superclass objects that provide common members, but otherwise there is no type safety or checking. Objects are called [[Record]]s and they represent native '' | ||
+ | myrec.newMember = 100</ | ||
+ | * There are only modifiable arrays. Non-modifiable tuples are not supported:< | ||
+ | array[1] = 100 | ||
+ | # array is now [1, 100, 3, 4]</ | ||
+ | * There are a couple of special assignment operators. Global assignment ('': | ||
+ | |||
+ | ===== Tutorial ===== | ||
+ | |||
+ | ==== Feature walkthrough ==== | ||
+ | |||
+ | The following pages walk though the features of Doomsday Script with brief code snippets: | ||
+ | <doctoc start=script: | ||
+ | |||
+ | ==== Examples ==== | ||
+ | |||
+ | These larger examples may be examined to get a better feel of what Doomsday Script is like in practice. (Spoiler alert: Very much like Python.) | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | ===== Using Doomsday Script ===== | ||
+ | |||
+ | As of [[version: | ||
+ | |||
+ | * **Animating 3D models:** | ||
+ | * [[assets: | ||
+ | * [[assets: | ||
+ | * [[assets: | ||
+ | * Manipulate shader variables, render passes, and the active material | ||
+ | * **Application: | ||
+ | * Loading fonts | ||
+ | * Callbacks for game load/unload | ||
+ | * **Audio:** | ||
+ | * [[.module: | ||
+ | * **Configuration: | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * **Console: | ||
+ | * [[.module: | ||
+ | * [[guide: | ||
+ | * **Definitions: | ||
+ | * [[script: | ||
+ | * **Files:** | ||
+ | * Reading/ | ||
+ | * **Game:** | ||
+ | * [[.module: | ||
+ | * **Input:** | ||
+ | * Binding controls and events (e.g., [[.module: | ||
+ | * [[https:// | ||
+ | * **Packages: | ||
+ | * [[fs: | ||
+ | * [[fs: | ||
+ | * [[fs: | ||
+ | * ing|onLoad/ | ||
+ | * **Players: | ||
+ | * [[.module: | ||
+ | * [[.module: | ||
+ | * **Things:** | ||
+ | * [[ded: | ||
+ | * [[.module: | ||
+ | * [[.module: | ||
+ | * [[.module: | ||
+ | * [[.module: | ||
+ | * [[ded: | ||
+ | |||
+ | In older versions: [[/ | ||
+ | |||
+ | |||
+ | ==== Editor support ==== | ||
+ | |||
+ | * Visual Studio Code: [[https:// | ||
+ | * [[https:// | ||
+ | ===== Language reference ===== | ||
+ | |||
+ | See the [[language|Language reference]] for information about the syntax, and built-in functions and [[script: | ||