Difference between revisions of "Scripting"
PeeWeeRotA (Talk | contribs) (→Scripting Tutorials) |
PeeWeeRotA (Talk | contribs) (→Commands) |
||
(28 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Installation Instructions == | == Installation Instructions == | ||
− | |||
− | + | ==== Download ==== | |
+ | Compiled binaries are available at the following link. Extract these to any folder and run using the command line. | ||
+ | https://drive.google.com/file/d/0B53xwpRlaEsdMHQwdjJ5Y19QcTg/view?usp=sharing | ||
+ | ==== Source ==== | ||
+ | The script compiler is available on GitHub. To build from source you will need to have a C++ compiler. (MSVC++ 2010 Express is free and is compatible with the provided project files) | ||
+ | |||
+ | https://github.com/ExiguusEntertainment/AAScriptCompiler | ||
== Scripting Tutorials == | == Scripting Tutorials == | ||
− | Scripts are written in .SRC files. These contain the script's source which is compiled into .SRP files by the A&A Script Compiler utility. BLANK.SRC, TEMPLATE.SRC, and L1.SRC are provided to show examples of scripting methods and layout. The L1.SRC is the source for Quest 1's first map (L30.MAP). This can be opened in Doom Builder 2 using the [[http://wiki.amuletsandarmor.com/index.php?title=Main_Page#A&A Classic Editor" | Classic Editor]]. | + | ==== Compiling ==== |
+ | Scripts are written in .SRC files. These contain the script's source which is compiled into .SRP files by the A&A Script Compiler utility. BLANK.SRC, TEMPLATE.SRC, and L1.SRC are provided to show examples of scripting methods and layout. The L1.SRC is the source for Quest 1's first map (L30.MAP). This can be opened in Doom Builder 2 using the [["http://wiki.amuletsandarmor.com/index.php?title=Main_Page#A&A Classic Editor" | Classic Editor]]. | ||
+ | |||
+ | Remember, compiled script files are formatted S###.SRP as opposed to all of the other level data files that begin with an "L". You will need to rename the outputted .SRP file using this format so that the game will be able to locate the file by map number. | ||
+ | |||
+ | ===== Example Command Line ===== | ||
+ | In the example below we will take L1.SRC as an input and save it as S30.SRP as the output to match the level naming schema | ||
+ | |||
+ | <code>AAScriptCompiler.exe L1.SRC S30.SRP</code> | ||
+ | |||
+ | ===== Help Compiling ===== | ||
+ | |||
+ | [[CommonScriptErrors | Common Script Errors]] - Help debugging issues that are causing the script compiler to fail | ||
+ | |||
+ | ==== Types of Scripts ==== | ||
+ | Scripts 0-200 run for all players. This should be used for moving platforms, opening doors, spawning monsters, traps, and playing world sounds. Every player will see this change. | ||
+ | |||
+ | Scripts 201-255 only run for the current player. Other players are not affected. This is used for teleporters, personal damage, and healing. Deactivating switches in this script should only happen on the client, allowing other players to see the same effect. You'll see this with healing pools in the main game. | ||
+ | |||
+ | All-player scripts can call personal scripts and vice versa. This means that a switch with a personal effect, like teleportation, can then call an all-player script to open a door as well. | ||
+ | |||
+ | Script 0 is the level load script. Since a special of 0 does not call any scripts for sectors and linedefs, it should not be possible to call Script 0 inside of a level. However it is possible to call it again in script with GoSub commands and NextScript properties. | ||
+ | |||
+ | ==== Calling Scripts ==== | ||
+ | Levels call scripts by either the player activating a linedef or stepping over a sector. Linedefs with a special will call the script number that matches the special. Sectors that have a special will call the script number that matches the special. | ||
+ | |||
+ | Inside of script, the GoSub command will call one of the other script numbers. This can chain scripts together and can even be used like GOTO commands in assembly languages to achieve loops and special logic. (Since scripts do not accept arguments, parameters need to be stored in global variables to use this kind of logic properly) | ||
+ | |||
+ | Some script commands contain the NextScript argument. This will call the specified script number once the command completes. | ||
=== Commands === | === Commands === | ||
Line 14: | Line 47: | ||
Below are a list of scripting commands with examples. (More added as examples are made) | Below are a list of scripting commands with examples. (More added as examples are made) | ||
− | [[ScriptChangeSideTexture|ChangeSideTexture]] | + | * [[ScriptActivateGenerator|ActivateGenerator]] |
+ | * [[ScriptAreaSound|AreaSound]] | ||
+ | * [[ScriptBlock| Block \ Unblock]] | ||
+ | * [[ScriptChangeSideTexture|ChangeSideTexture]] | ||
+ | * [[ScriptCompare|Compare]] | ||
+ | * [[ScriptDeactiveGenerator|DeactiveGenerator]] | ||
+ | * [[ScriptDelay|Delay]] | ||
+ | * [[ScriptEffect|Effect]] | ||
+ | * [[ScriptEnd|End]] | ||
+ | * [[ScriptGenerateMissile|GenerateMissile]] | ||
+ | * [[ScriptGoto|Goto]] | ||
+ | * [[ScriptGosub|Gosub]] | ||
+ | * [[ScriptIf|If]] | ||
+ | * [[ScriptObjectSetType|ObjectSetType]] | ||
+ | * [[ScriptPrint|Print]] | ||
+ | * [[ScriptSet|Set]] | ||
+ | * [[ScriptSlideCeilingNice|SlideCeilingNice]] | ||
+ | * [[ScriptSlideFloorNice|SlideFloorNice]] | ||
+ | * [[ScriptSound|Sound]] | ||
+ | * [[ScriptTeleport|Teleport]] | ||
+ | |||
+ | |||
+ | |||
+ | ---- | ||
+ | Back to [[Editor]] Main Page |
Latest revision as of 20:43, 2 December 2016
Contents
Installation Instructions
Download
Compiled binaries are available at the following link. Extract these to any folder and run using the command line.
https://drive.google.com/file/d/0B53xwpRlaEsdMHQwdjJ5Y19QcTg/view?usp=sharing
Source
The script compiler is available on GitHub. To build from source you will need to have a C++ compiler. (MSVC++ 2010 Express is free and is compatible with the provided project files)
https://github.com/ExiguusEntertainment/AAScriptCompiler
Scripting Tutorials
Compiling
Scripts are written in .SRC files. These contain the script's source which is compiled into .SRP files by the A&A Script Compiler utility. BLANK.SRC, TEMPLATE.SRC, and L1.SRC are provided to show examples of scripting methods and layout. The L1.SRC is the source for Quest 1's first map (L30.MAP). This can be opened in Doom Builder 2 using the Classic Editor.
Remember, compiled script files are formatted S###.SRP as opposed to all of the other level data files that begin with an "L". You will need to rename the outputted .SRP file using this format so that the game will be able to locate the file by map number.
Example Command Line
In the example below we will take L1.SRC as an input and save it as S30.SRP as the output to match the level naming schema
AAScriptCompiler.exe L1.SRC S30.SRP
Help Compiling
Common Script Errors - Help debugging issues that are causing the script compiler to fail
Types of Scripts
Scripts 0-200 run for all players. This should be used for moving platforms, opening doors, spawning monsters, traps, and playing world sounds. Every player will see this change.
Scripts 201-255 only run for the current player. Other players are not affected. This is used for teleporters, personal damage, and healing. Deactivating switches in this script should only happen on the client, allowing other players to see the same effect. You'll see this with healing pools in the main game.
All-player scripts can call personal scripts and vice versa. This means that a switch with a personal effect, like teleportation, can then call an all-player script to open a door as well.
Script 0 is the level load script. Since a special of 0 does not call any scripts for sectors and linedefs, it should not be possible to call Script 0 inside of a level. However it is possible to call it again in script with GoSub commands and NextScript properties.
Calling Scripts
Levels call scripts by either the player activating a linedef or stepping over a sector. Linedefs with a special will call the script number that matches the special. Sectors that have a special will call the script number that matches the special.
Inside of script, the GoSub command will call one of the other script numbers. This can chain scripts together and can even be used like GOTO commands in assembly languages to achieve loops and special logic. (Since scripts do not accept arguments, parameters need to be stored in global variables to use this kind of logic properly)
Some script commands contain the NextScript argument. This will call the specified script number once the command completes.
Commands
Below are a list of scripting commands with examples. (More added as examples are made)
- ActivateGenerator
- AreaSound
- Block \ Unblock
- ChangeSideTexture
- Compare
- DeactiveGenerator
- Delay
- Effect
- End
- GenerateMissile
- Goto
- Gosub
- If
- ObjectSetType
- Set
- SlideCeilingNice
- SlideFloorNice
- Sound
- Teleport
Back to Editor Main Page