Difference between revisions of "Config Commands"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Commands)
 
(3 intermediate revisions by one other user not shown)
Line 2: Line 2:
  
 
== Commands ==
 
== Commands ==
 +
 +
 +
; difficulty(number);
 +
: Sets difficulty in Zombie Fortress, affecting number of zombies.
 +
<syntaxhighlight lang="cpp" enclose="div">
 +
difficulty(666);
 +
</syntaxhighlight>
  
 
; LoadRules("path/to/rules.cfg");
 
; LoadRules("path/to/rules.cfg");
 
: Loads a gamemode rules file, such as a gamemode.cfg file. This file must be a "cfg" file, and will adjust the rules for the server. It requires a map restart to take effect.
 
: Loads a gamemode rules file, such as a gamemode.cfg file. This file must be a "cfg" file, and will adjust the rules for the server. It requires a map restart to take effect.
<syntaxhighlight lang="gml">
+
<syntaxhighlight lang="cpp" enclose="div">
 
LoadMap("Rules/MODE/gamemode.cfg");
 
LoadMap("Rules/MODE/gamemode.cfg");
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 11: Line 18:
 
; LoadMap("path/to/map.cfg/or/map.gm");
 
; LoadMap("path/to/map.cfg/or/map.gm");
 
: Loads a map .png or .gm file. Will automatically restart the round and load the map if run. Example:
 
: Loads a map .png or .gm file. Will automatically restart the round and load the map if run. Example:
<syntaxhighlight lang="gml">
+
<syntaxhighlight lang="cpp" enclose="div">
 
LoadMap("Rules/MODE/Maps/mymap.gm");
 
LoadMap("Rules/MODE/Maps/mymap.gm");
 
</syntaxhighlight>
 
</syntaxhighlight>
  
; addBlob(`item-name`, `Path/To/Entity/File.cfg`,Xposition,Yposition,Team);
+
; addBlob("item-name", "Path/To/Entity/File.cfg",Xposition,Yposition,Team);
 
: Loads a named entity at the given X and Y position, for the given team (0 = blue, 1 = red, 3 = neutral). For example, this loads a lantern for Red at 64x64 on the map:
 
: Loads a named entity at the given X and Y position, for the given team (0 = blue, 1 = red, 3 = neutral). For example, this loads a lantern for Red at 64x64 on the map:
<syntaxhighlight lang="gml">
+
<syntaxhighlight lang="cpp" enclose="div">
addBlob(`mylantern`, `Entities/Items/Lantern.cfg`,64 ,64,0);
+
addBlob("mylantern", "Entities/Items/Lantern.cfg",64 ,64,0);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
; waterLevel(123);
+
; waterLevel(number);
: Sets the water level at the specified number of tiles from the bottom of the map. The game mode config variable "water_suddendeath" must be set to true for this to work. Example to load the water at 20 tiles from the bottom of the map:
+
; waterWaveAmplitude(number);
<syntaxhighlight lang="gml">
+
; waterWavePeriod(number);
 +
: Sets the water level (and other parameters) at the specified number of tiles from the bottom of the map. The game mode config variable "water_suddendeath" must be set to true for this to work. Example to load the water at 20 tiles from the bottom of the map:
 +
<syntaxhighlight lang="cpp" enclose="div">
 
waterLevel(20);
 
waterLevel(20);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
; addBotX(Team,Class, `Name of the Bot`);
+
; addBotX(Team,Class, "Name of the Bot");
 
: Adds an AI-run bot to the map. First parameter is the team (0 = blue, 1 = red, 3 = neutral). Second is the class (0 = knight, 2 = archer, 1 = builder). Final parameter is the name to give the bot. Example to load a knight named "George" for the blue team:
 
: Adds an AI-run bot to the map. First parameter is the team (0 = blue, 1 = red, 3 = neutral). Second is the class (0 = knight, 2 = archer, 1 = builder). Final parameter is the name to give the bot. Example to load a knight named "George" for the blue team:
<syntaxhighlight lang="gml">
+
<syntaxhighlight lang="cpp" enclose="div">
addBotX(0,0,`George`);
+
addBotX(0,0,"George");
 
</syntaxhighlight>
 
</syntaxhighlight>
  
; serverMessage(`Message`);
+
; serverMessage("Message");
 
: Sends a server message (in-game chat message) to the server. Example:
 
: Sends a server message (in-game chat message) to the server. Example:
<syntaxhighlight lang="gml">
+
<syntaxhighlight lang="cpp" enclose="div">
serverMessage(`Begin the match!`);
+
serverMessage("Begin the match!");
 
</syntaxhighlight>
 
</syntaxhighlight>
  
; print(`Message`);
+
; print("Message");
 
: Prints a message to the log file. Example:
 
: Prints a message to the log file. Example:
<syntaxhighlight lang="gml">
+
<syntaxhighlight lang="cpp" enclose="div">
print(`Config files loaded, we are good.`);
+
print("Config files loaded, we are good.");
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
; sleep(1.0);
 
; sleep(1.0);
; "Sleeps", or pauses the script, for X number of seconds. Example to pause for 2 seconds:
+
: "Sleeps", or pauses the script, for X number of seconds. Example to pause for 2 seconds:
<syntaxhighlight lang="gml">
+
<syntaxhighlight lang="cpp" enclose="div">
 
sleep(2.0);
 
sleep(2.0);
 +
</syntaxhighlight>
 +
 +
; readControls(filename);
 +
; endControls();
 +
; recControls(filename);
 +
; readEvents(filename);
 +
; endEvents();
 +
; recEvents(filename);
 +
: https://forum.kag2d.com/threads/recording-controls.10369/
 +
<syntaxhighlight lang="cpp" enclose="div">
 +
readControls("demo2");
 +
</syntaxhighlight>
 +
 +
; listPlayers();
 +
: Lists all players on server.
 +
 +
; console(command);
 +
: Executes a [[commands|console command]]
 +
<syntaxhighlight lang="cpp" enclose="div">
 +
console("reloadsecurity");
 +
</syntaxhighlight>
 +
 +
; printBandwidth();
 +
: ???
 +
 +
== Running Commands via RCON ==
 +
 +
Simply prefix the command with /rcon. For example, to print a server message:
 +
 +
<syntaxhighlight lang="cpp" enclose="div">
 +
/rcon serverMessage("Run via RCON!");
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 23:11, 22 February 2013

Various commands are available to .gm files when they are loaded. They can be run in any .gm file during server load, or run using RCON. All commands must end with a semicolon (;).

Commands

difficulty(number);
Sets difficulty in Zombie Fortress, affecting number of zombies.
difficulty(666);
LoadRules("path/to/rules.cfg");
Loads a gamemode rules file, such as a gamemode.cfg file. This file must be a "cfg" file, and will adjust the rules for the server. It requires a map restart to take effect.
LoadMap("Rules/MODE/gamemode.cfg");
LoadMap("path/to/map.cfg/or/map.gm");
Loads a map .png or .gm file. Will automatically restart the round and load the map if run. Example:
LoadMap("Rules/MODE/Maps/mymap.gm");
addBlob("item-name", "Path/To/Entity/File.cfg",Xposition,Yposition,Team);
Loads a named entity at the given X and Y position, for the given team (0 = blue, 1 = red, 3 = neutral). For example, this loads a lantern for Red at 64x64 on the map:
addBlob("mylantern", "Entities/Items/Lantern.cfg",64 ,64,0);
waterLevel(number);
waterWaveAmplitude(number);
waterWavePeriod(number);
Sets the water level (and other parameters) at the specified number of tiles from the bottom of the map. The game mode config variable "water_suddendeath" must be set to true for this to work. Example to load the water at 20 tiles from the bottom of the map:
waterLevel(20);
addBotX(Team,Class, "Name of the Bot");
Adds an AI-run bot to the map. First parameter is the team (0 = blue, 1 = red, 3 = neutral). Second is the class (0 = knight, 2 = archer, 1 = builder). Final parameter is the name to give the bot. Example to load a knight named "George" for the blue team:
addBotX(0,0,"George");
serverMessage("Message");
Sends a server message (in-game chat message) to the server. Example:
serverMessage("Begin the match!");
print("Message");
Prints a message to the log file. Example:
print("Config files loaded, we are good.");
sleep(1.0);
"Sleeps", or pauses the script, for X number of seconds. Example to pause for 2 seconds:
sleep(2.0);
readControls(filename);
endControls();
recControls(filename);
readEvents(filename);
endEvents();
recEvents(filename);
https://forum.kag2d.com/threads/recording-controls.10369/
readControls("demo2");
listPlayers();
Lists all players on server.
console(command);
Executes a console command
console("reloadsecurity");
printBandwidth();
 ???

Running Commands via RCON

Simply prefix the command with /rcon. For example, to print a server message:

/rcon serverMessage("Run via RCON!");

See Also