Doomsday 2 has a built-in scripting language that is used internally for various tasks.
Doomsday Script is a full-featured programming language, with features such as exceptions and an object system with classes.
Scripting is used for several things internally, for example managing engine configuration and controlling 3D model asset animation. Doomsday Script is not a compiled language and thus is not intended for high-performance or time-critical tasks. Game plugins, for instance, should be written in native code.
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:
:) always indicates a single-line compound that does not need to be closed:
def func2(): return 'World'
record myrec myrec.newMember = 100
array = [1, 2, 3, 4] array = 100 # array is now [1, 100, 3, 4]
:=) will assign into variables in parent scopes if no local variable with the given name is found. Weak assignment (
?=) will only assign a value if a variable has not yet been created.