Script.txt: Difference between revisions

From Spring
Jump to navigationJump to search
8611 (talk | contribs)
added: minimum script, generating scripts
Gajop (talk | contribs)
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 9: Line 9:
See {{sourcelink|file=doc/StartScriptFormat.txt}} for a more detailed example.
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. Addtionally 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.
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


<code><pre>[GAME]
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
   // game attributes
Line 47: Line 51:
     // values for the options defined in Mapoptions.lua
     // values for the options defined in Mapoptions.lua
   }
   }
}</pre></code>
}</pre>
 


= Examples =
= Examples =
== minimal functional startscript ==
== minimal functional startscript ==
Based on {{forumlink|topic=32893&p=566971#p566953|title=these two posts:}}  
Based on {{forumlink|topic=32893&p=566971#p566953|title=these two posts:}}  
<code><pre>
<pre>
[GAME]
[GAME]
{
{
Line 72: Line 75:
}
}
}
}
</pre></code>
</pre>




Line 86: Line 89:
== Converting Lua tables to script.txt format ==
== Converting Lua tables to script.txt format ==


{{forumlink|topic=t=32643|title=lua table -> script.txt generator}} - thread with two examples
{{forumlink|topic=32643|title=lua table -> script.txt generator}} - thread with two examples


[[Category:Development]]
[[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