1: Download and install Microsoft Visual Studio Community.
2: Create a new C# console project.
3: Add a new reference and browse to the SFD.GameScriptInterface.dll file and select it in the SFD installation folder.
4: Create and add the following class to your project:
Code: Select all
// All available system namespaces in the ScriptAPI (as of Alpha 1.0.0).
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using SFDGameScriptInterface;
namespace ConsoleApplication1
{
class GameScript : GameScriptInterface
{
/// <summary>
/// Placeholder constructor that's not to be included in the ScriptWindow!
/// </summary>
public GameScript() : base(null) { }
/* SCRIPT STARTS HERE - COPY BELOW INTO THE SCRIPT WINDOW */
// Run code before triggers marked with "Activate on startup" but after players spawn from SpawnMarkers.
public void OnStartup()
{
HelloWorld();
}
// Run code after triggers marked with "Activate on startup".
public void AfterStartup()
{
}
// Run code on map restart (or script disabled).
public void OnShutdown()
{
}
void HelloWorld()
{
Game.ShowPopupMessage("Hello World!");
}
/* SCRIPT ENDS HERE - COPY ABOVE INTO THE SCRIPT WINDOW */
}
}
This was first a reply in viewtopic.php?f=12&t=816 but I now lift it as it's own topic.
See how to debug scripts in SFD.