Script.txt: Difference between revisions

From Spring
Jump to navigationJump to search
Abma (talk | contribs)
No edit summary
Gajop (talk | contribs)
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Start script file for spring rts. See https://github.com/spring/spring/blob/master/doc/StartScriptFormat.txt for more info.
= Script.txt =
Start script file for Spring Engine.  


Lobbies create it for spring, usually found in <code>~/.spring/script.txt</code> on Linux/MacOSX.


Lobbies create it for spring, usally found in ~/.spring/script.txt on Linux/MacOSX.
On Windows it can be found mostly in <code>My Documents\My Games\Spring\script.txt</code> or next to spring.exe.


On Windows it can be found mostly in My Documents\My Games\Spring\script.txt or next to spring.exe.
== Structure ==
See {{sourcelink|file=doc/StartScriptFormat.txt}} for a more detailed example.
 
Spring 97.0 added <code>GAME/MUTATOR{0..9}</code> so you can load arbitrary mutator archives before the game. Additionally since 97.0 <code>GAME/GameID</code> is the only seed of the synced random generator, so you can define the <code>GameID</code> in a luaAI battle startscript and you will always get a syncing match.
 
Since 99.0 <code>GAME/Gametype</code> can be a [[rapid]] tag, and demo recording can be disabled by setting <code>GAME/RecordDemo</code> to 0
 
Since 102.0 <code>GAME/SaveFile</code> can be specified in start script in order to start from a (lua) save (.slsf).
 
Overview of the structure:
<pre>[GAME]
{
  // game attributes
  [MUTATOR0]
  {
    // mutator attributes
  }
  [AI0]
  {
    // AI attributes
  }
  [PLAYER0]
  {
    // player attributes
  }
  [TEAM0]
  {
    // team attributes
  }
  [ALLYTEAM0]
  {
    // ally team attributes
  }
  [RESTRICT]
  {
    // restrictions
  }
  [MODOPTIONS]
  {
    // values for the options defined in Modoptions.lua
  }
  [MAPOPTIONS]
  {
    // values for the options defined in Mapoptions.lua
  }
}</pre>
 
= Examples =
== minimal functional startscript ==
Based on {{forumlink|topic=32893&p=566971#p566953|title=these two posts:}}
<pre>
[GAME]
{
MapName=DeltaSiegeDry;
GameType=Balanced Annihilation V8.10;
IsHost=1;
[PLAYER0]
{
Team=0;
}
[TEAM0]
{
TeamLeader=0;
AllyTeam=0;
}
[ALLYTEAM0]
{
}
}
</pre>
 
 
== More examples ==
startscripts used for pre-defined offline matches vs AI in different team configurations - 
https://code.google.com/p/springtanks/source/browse/#svn%2Ftrunk%2FMissions
 
= Generating startscripts =
It is possible to use for example Springlobby to setup a game via the Singleplayer tab.
 
The temporary file that gets generated can be copied for further use.
 
== Converting Lua tables to script.txt format ==
 
{{forumlink|topic=32643|title=lua table -> script.txt generator}} - thread with two examples
 
[[Category:Development]]

Latest revision as of 16:49, 15 January 2019

Script.txt

Start script file for Spring Engine.

Lobbies create it for spring, usually found in ~/.spring/script.txt on Linux/MacOSX.

On Windows it can be found mostly in My Documents\My Games\Spring\script.txt or next to spring.exe.

Structure

See doc/StartScriptFormat.txt for a more detailed example.

Spring 97.0 added GAME/MUTATOR{0..9} so you can load arbitrary mutator archives before the game. Additionally since 97.0 GAME/GameID is the only seed of the synced random generator, so you can define the GameID in a luaAI battle startscript and you will always get a syncing match.

Since 99.0 GAME/Gametype can be a rapid tag, and demo recording can be disabled by setting GAME/RecordDemo to 0

Since 102.0 GAME/SaveFile can be specified in start script in order to start from a (lua) save (.slsf).

Overview of the structure:

[GAME]
{
  // game attributes
  [MUTATOR0]
  {
    // mutator attributes
  }
  [AI0]
  {
    // AI attributes
  }
  [PLAYER0]
  {
    // player attributes
  }
  [TEAM0]
  {
    // team attributes
  }
  [ALLYTEAM0]
  {
    // ally team attributes
  }
  [RESTRICT]
  {
    // restrictions
  }
  [MODOPTIONS]
  {
    // values for the options defined in Modoptions.lua
  }
  [MAPOPTIONS]
  {
    // values for the options defined in Mapoptions.lua
  }
}

Examples

minimal functional startscript

Based on these two posts:

[GAME]
{
	MapName=DeltaSiegeDry;
	GameType=Balanced Annihilation V8.10;
	IsHost=1;
	[PLAYER0]
	{
		Team=0;
	}
	[TEAM0]
	{
		TeamLeader=0;
		AllyTeam=0;
	}
	[ALLYTEAM0]
	{
	}
}


More examples

startscripts used for pre-defined offline matches vs AI in different team configurations - https://code.google.com/p/springtanks/source/browse/#svn%2Ftrunk%2FMissions

Generating startscripts

It is possible to use for example Springlobby to setup a game via the Singleplayer tab.

The temporary file that gets generated can be copied for further use.

Converting Lua tables to script.txt format

lua table -> script.txt generator - thread with two examples