ScriptAPI

Script API is a Map Editor feature that was added in PreAlpha 1.4.0.

Usage
Referred to in the Update Log as scripting, it was implemented for "advanced map makers" so that they could write specialized functions into the Map Editor using C#, the same language used to run SFD. With this feature, players can not only access blocks given a "CustomID" in the game, but also create their own and create interactions which triggers are limited to recreating standalone, if they understand basic C# programming.

The power of the script module not only allows players to call as many functions as they wantundefined
 * , but also to wherever the game will allow them to access. Because SFD is being updated regularly with new features, the game will continue to feature more accessible components.

Script Tab
To access the Scripting Module, look to the top right of the Map Editor window. You will see the "Layers" tab, and the "Script" tab. Clicking the "Script" tab opens the Scripting Module.

​Getting Started.
Always the map will try to call the OnStartup method, which is the main one in the Map editor. Else the mothod must be called by a trigger (when activated), but using in this case the "TriggerArgs args" method. Remember that OnStartup can only be runned 1 time.

Also the map will try to call the AfterStartup method when all the other methods have been activated. Remember that  AfterStartup can only be runned 1 time.

This is an example of using OnStartup method.

​'''​Method to set some commands  and giving players weapons. Some commands can't be runned in the game using scripting.'''

​​public void OnStartup       // This method will run at the beginning of each round. ​{          /* METHOD OF THE SCRIPT START HERE*/ Game.RunComman​d("/IA 1");                       // To set infinite ammo. 1 = ON, 0 = OFF. Game.RunCommand("/MSG [TEXT] ");                // To spawn a message in red letters. Game.RunCommand("/IE 0");                       // To set ifinite energy. 0 = OFF, 1 = ON. foreach(IPlayer ply in Game.GetPlayers)       // For each player in the game (dead or alive). {             ply.GiveWeaponItem(WeaponItem.KATANA);     // A katana will be given to the players. ply.GiveWeaponItem(WeaponItem.PISTOL);    // A pistol will be given to the players. /* SCRIPT END HERE */ } }

You can also find another script by going to SFDMaps and read their codes to see hhow each one works. http://sfdmaps.at.ua/load/scripts/3