<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.teamspec.net/index.php?action=history&amp;feed=atom&amp;title=Level_Editor%2FScripting%2FTesting</id>
	<title>Level Editor/Scripting/Testing - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.teamspec.net/index.php?action=history&amp;feed=atom&amp;title=Level_Editor%2FScripting%2FTesting"/>
	<link rel="alternate" type="text/html" href="https://wiki.teamspec.net/index.php?title=Level_Editor/Scripting/Testing&amp;action=history"/>
	<updated>2026-10-29T00:59:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.teamspec.net/index.php?title=Level_Editor/Scripting/Testing&amp;diff=65&amp;oldid=prev</id>
		<title>TeamSpecBot: Level Editor: testing a gamemode</title>
		<link rel="alternate" type="text/html" href="https://wiki.teamspec.net/index.php?title=Level_Editor/Scripting/Testing&amp;diff=65&amp;oldid=prev"/>
		<updated>2026-10-20T03:46:24Z</updated>

		<summary type="html">&lt;p&gt;Level Editor: testing a gamemode&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;To test a gamemode you run the map in TeamSpec and read what your scripts print. How to start the game from the editor is on [[Level Editor/Workflows/Playtesting|Playtesting]]; this page is about checking the scripts.&lt;br /&gt;
&lt;br /&gt;
{{Note|Set &amp;#039;&amp;#039;&amp;#039;TeamSpec Executable Path&amp;#039;&amp;#039;&amp;#039; in [[Level Editor/Settings|Settings]] first. Run and the playtest buttons need it.}}&lt;br /&gt;
&lt;br /&gt;
== Ways to run ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Run &amp;gt; Run (Console)&amp;#039;&amp;#039;&amp;#039; is the best way to test scripts: it starts TeamSpec on a copy of the map with a console window (&amp;lt;code&amp;gt;TeamSpec.console.exe&amp;lt;/code&amp;gt;, when it is beside &amp;lt;code&amp;gt;TeamSpec.exe&amp;lt;/code&amp;gt;) that shows everything the game prints.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Quick Playtest / Apply&amp;#039;&amp;#039;&amp;#039; keeps the game open and sends your new scripts to it each time you apply. The status line reports every step, including why a change was refused. A script that steps outside the [[Level Editor/Scripting/Sandbox limits|sandbox]] is refused like this, and the game keeps the last version that worked:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Playtest could not apply: Map validation failed: server.gd (server script): line 12: `OS` is not available to a server script; the current world is unchanged.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading the output ==&lt;br /&gt;
* [[Level Editor/Scripting/Reference/GamemodeServerApi#log|api.log]] prints a line tagged with the map and the side: &amp;lt;code&amp;gt;[gamemode/mymap server] your message&amp;lt;/code&amp;gt;. The bot script&amp;#039;s lines are tagged &amp;lt;code&amp;gt;server&amp;lt;/code&amp;gt; too, because it runs there. &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; works as well, without the tag.&lt;br /&gt;
* When the map starts, the game prints the zones it found, for example &amp;lt;code&amp;gt;[gamemode] mymap: 3 zone(s)&amp;lt;/code&amp;gt; followed by their names. If a zone your script expects is missing from that line, check its &amp;#039;&amp;#039;&amp;#039;Is Area&amp;#039;&amp;#039;&amp;#039; box and its &amp;#039;&amp;#039;&amp;#039;Trigger Name&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
* A player falling out of the world prints where it happened: &amp;lt;code&amp;gt;[left_world] entity 7 judged out of the world at (...)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Before you test ==&lt;br /&gt;
* &amp;lt;code&amp;gt;_player_died&amp;lt;/code&amp;gt; calls &amp;lt;code&amp;gt;api.respawn_in&amp;lt;/code&amp;gt;, unless nobody should come back.&lt;br /&gt;
* Every counter the client script shows is declared in the server script&amp;#039;s &amp;lt;code&amp;gt;_declare()&amp;lt;/code&amp;gt;, spelt the same way.&lt;br /&gt;
* Your script compares &amp;lt;code&amp;gt;api.zone_label(zone)&amp;lt;/code&amp;gt; with names that match the zones&amp;#039; &amp;#039;&amp;#039;&amp;#039;Trigger Name&amp;#039;&amp;#039;&amp;#039; exactly, capitals and spaces included.&lt;br /&gt;
* Every team you use has spawn points, and there is a &amp;#039;&amp;#039;&amp;#039;World Boundary&amp;#039;&amp;#039;&amp;#039; below the map. See [[Level Editor/Scripting/Teams and spawning#Spawn points|Teams and spawning]].&lt;br /&gt;
&lt;br /&gt;
When the mode works, export it with &amp;#039;&amp;#039;&amp;#039;File &amp;gt; Export to TeamSpec (.tsmap)&amp;#039;&amp;#039;&amp;#039;. See [[Level Editor/Workflows/Exporting and publishing|Exporting and publishing]].&lt;br /&gt;
&lt;br /&gt;
{{Level Editor nav}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Level Editor]]&lt;br /&gt;
[[Category:Gamemode scripting]]&lt;/div&gt;</summary>
		<author><name>TeamSpecBot</name></author>
	</entry>
</feed>