Scripting

From Amulets & Armor Wiki
Revision as of 18:03, 20 February 2015 by LysleShields (Talk | contribs)

Jump to: navigation, search

Installation Instructions

The script compiler is available on GitHub. Currently you will need to have a C++ compiler in order to build it. (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" | 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.

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)