Difference between revisions of "SC3 Config File"

From Soldat Community Wiki
Jump to: navigation, search
m (Morko moved page Script Core 3 Config File to SC3 Config File: Naming)
 
(9 intermediate revisions by 5 users not shown)
Line 8: Line 8:
 
|-
 
|-
 
| Name
 
| Name
| The name of the script. Appears everywhere in console output that is related to that script (compile messages, exceptions). Must be at most 25 characters long.
+
| The name of the script. Appears everywhere in console output that is related to that script (compile messages, exceptions). Must be at most 20 characters long.
 
| align="center" | String
 
| align="center" | String
 
| align="center" | Yes
 
| align="center" | Yes
| align="center" | none
+
| align="center" | N/A
 
|-
 
|-
 
| MainFile
 
| MainFile
Line 28: Line 28:
 
| Sandbox level for the script. possible values:
 
| Sandbox level for the script. possible values:
 
* 0: access to entire harddrive
 
* 0: access to entire harddrive
* 1: access restricted to entire soldatserver/ folder
+
* 1: access restricted to entire soldatserver/ folder  
 
* 2: access restricted to script's data folder (soldatserver/scripts/<script name>/data
 
* 2: access restricted to script's data folder (soldatserver/scripts/<script name>/data
 
This value can be constrained by server.ini file.
 
This value can be constrained by server.ini file.
Line 42: Line 42:
 
|-
 
|-
 
| AllowIniEdit
 
| AllowIniEdit
| Used only if Sandboxed is set to 1. Determinates whenever script is allowed to read/write soldat.ini and server.ini. This value can be constrained by server.ini file.
+
| Used only if Sandboxed is set to 1. Determinates whenever script is allowed to read/write [[soldat.ini]] and server.ini. This value can be constrained by server.ini file.
 
| align="center" | Boolean (1 or 0)
 
| align="center" | Boolean (1 or 0)
 
| align="center" | No
 
| align="center" | No
Line 54: Line 54:
 
|-
 
|-
 
| Legacy
 
| Legacy
| Whenever the script should run in legacy mode or not. Legacy mode adds all interface and events known from ScriptCore 2. Usfeul for migrating the scripts.
+
| Whenever the script should run in legacy mode or not. Legacy mode adds all interface and events known from ScriptCore 2. Useful for migrating the scripts.
 
| align="center" | Boolean (1 or 0)
 
| align="center" | Boolean (1 or 0)
 
| align="center" | No
 
| align="center" | No
Line 77: Line 77:
  
 
==Defines==
 
==Defines==
[Defines] section defines preprocessor constants that should be exported to the script. Besides those defined here, script will also recieve WINDOWS/UNIX constant depending on operating system it runs on. Defines should be enter delimited, each define in new line. Script also inherits all defines defined in server.ini file.<br>
+
[Defines] section defines preprocessor constants that should be exported to the script. Besides those defined here, script will also recieve WIN32/LINUX constant depending on operating system it runs on. Defines should be enter delimited, each define in new line. Script also inherits all defines defined in server.ini file.<br>
 
Example:
 
Example:
 
   [Defines]
 
   [Defines]
Line 87: Line 87:
  
 
==Example==
 
==Example==
Complete file made from this article's example would look like this:
+
Complete file made from this article's examples would look like this:
 
   [Config]
 
   [Config]
 
   Name=My awesome script
 
   Name=My awesome script

Latest revision as of 10:22, 8 July 2018

Config file is divded into three sections: Config, SearchPaths and Defines. First one defines all the basic properties, 2nd paths in which to search all the unit/include files and 3rd pre-defines preprocessor defines.

Config

Key Description Type Required Default value
Name The name of the script. Appears everywhere in console output that is related to that script (compile messages, exceptions). Must be at most 20 characters long. String Yes N/A
MainFile The name of entry file for the script. String No main.pas
Debug Whenever script should run in debug mode or not. In debug mode, debug symbols are also compiled and used during runtime. This allows displaying line and unit name in case of exception. Boolean (1 or 0) No 0
Sandboxed Sandbox level for the script. possible values:
  • 0: access to entire harddrive
  • 1: access restricted to entire soldatserver/ folder
  • 2: access restricted to script's data folder (soldatserver/scripts/<script name>/data

This value can be constrained by server.ini file.

Integer No 2
AllowDlls Whenever the script is allowed to load external dlls. This value can be constrained by server.ini file. Boolean (1 or 0) No 0
AllowIniEdit Used only if Sandboxed is set to 1. Determinates whenever script is allowed to read/write soldat.ini and server.ini. This value can be constrained by server.ini file. Boolean (1 or 0) No 0
Gamemod Whenever the script is a gamemod. Gamemod script mark server as gamemod server and thus make it displayed as such in the lobby Boolean (1 or 0) No 0
Legacy Whenever the script should run in legacy mode or not. Legacy mode adds all interface and events known from ScriptCore 2. Useful for migrating the scripts. Boolean (1 or 0) No 0

Example:

 [Config]
 Name=My awesome script
 MainFile=events.pas
 Sandboxed=1
 Legacy=1

SearchPaths

[SearchPaths] section defines all the folders that should be scanned for unit files. Paths should be delimited by enter, each path in new line. Paths can contain "../" which allows to make script use some "shared" units folder. Paths are relative to script's root folder (soldatserver/scripts/<script name>). They also inherit paths defined in server.ini file, which are also relative to root folder of script they're applied to. Script's root folder is scanned by default, there's no need to add "." search path.
Example:

 [SearchPaths]
 /players
 /players/tasks
 /game/
 ../shared

Defines

[Defines] section defines preprocessor constants that should be exported to the script. Besides those defined here, script will also recieve WIN32/LINUX constant depending on operating system it runs on. Defines should be enter delimited, each define in new line. Script also inherits all defines defined in server.ini file.
Example:

 [Defines]
 TEST
 DEBUG
 FANCY
 lowercasedarealsook

Example

Complete file made from this article's examples would look like this:

 [Config]
 Name=My awesome script
 MainFile=events.pas
 Sandboxed=1
 Legacy=1
 
 [SearchPaths]
 /players
 /players/tasks
 /game/
 ../shared
 
 [Defines]
 TEST
 DEBUG
 FANCY
 lowercasedarealsook