<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.skytemple.org/index.php?action=history&amp;feed=atom&amp;title=SSBScript</id>
	<title>SSBScript - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.skytemple.org/index.php?action=history&amp;feed=atom&amp;title=SSBScript"/>
	<link rel="alternate" type="text/html" href="https://wiki.skytemple.org/index.php?title=SSBScript&amp;action=history"/>
	<updated>2026-07-16T15:32:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.skytemple.org/index.php?title=SSBScript&amp;diff=1574&amp;oldid=prev</id>
		<title>Adex: Document SSBScript</title>
		<link rel="alternate" type="text/html" href="https://wiki.skytemple.org/index.php?title=SSBScript&amp;diff=1574&amp;oldid=prev"/>
		<updated>2026-07-05T19:14:11Z</updated>

		<summary type="html">&lt;p&gt;Document SSBScript&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;SSBScript is a custom programming language, created by [[User:Capypara|Capypara]], used to edit the game&amp;#039;s SSB files. It is the lower-level counterpart to [[ExplorerScript]], meaning that it provides a more raw representation of a script&amp;#039;s code. An SSBScript file would only consist of [[List of Opcodes|scripting opcodes]] without many programming abstractions usable in ExplorerScript. This includes, but is not limited to:&lt;br /&gt;
&lt;br /&gt;
* Loops&lt;br /&gt;
* Conditional statements&lt;br /&gt;
* Simple entity targeting (e.g., with-statements)&lt;br /&gt;
&lt;br /&gt;
SkyTemple does not currently support a way to toggle between ExplorerScript and SSBScript in the script editor. &lt;br /&gt;
&lt;br /&gt;
== SSBScript Decompilation Fallback ==&lt;br /&gt;
Starting with SkyTemple 1.8.0, some scripts that would fail to decompile to ExplorerScript would instead fall back to an SSBScript representation. All scripts decompiled using this feature begin with the following comment block:&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
//?: is-ssb-script: true&lt;br /&gt;
// WARNING:&lt;br /&gt;
// Failed to normally decompile this script. This is either because of a bug&lt;br /&gt;
// in the decompiler or because this script was not valid.&lt;br /&gt;
//&lt;br /&gt;
// The following is a fallback decompilation as SsbScript that may not be as easy to read.&lt;br /&gt;
//&lt;br /&gt;
// IMPORTANT: This is now SsbScript instead of ExplorerScript. If you remove the very first&lt;br /&gt;
// line (//?: is-ssb-script: true), then the compiler will try to compile this file &lt;br /&gt;
// as ExplorerScript again.&lt;br /&gt;
// Before this is possible you will need to re-write this file to be valid ExplorerScript.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;While reasons for a failed ExplorerScript decompilation may vary, the most common cause is control flow. It is strongly recommended to always keep backups of your ExplorerScript source files (present within the &amp;lt;code&amp;gt;SCRIPT&amp;lt;/code&amp;gt; directory of the ROM&amp;#039;s associated &amp;lt;code&amp;gt;.nds.skytemple&amp;lt;/code&amp;gt; directory).&lt;br /&gt;
&lt;br /&gt;
== Comparison to ExplorerScript ==&lt;br /&gt;
SSBScript lacks many typical programmatic abstractions of ExplorerScript due to solely relying on SSB opcodes. As such, while SSBScript is very likely more difficult to read than ExplorerScript, it offers a more accurate view of the underlying opcodes a script contains, including [[List of Opcodes#Other Opcodes|certain opcodes]] you may not otherwise see in ExplorerScript.&lt;br /&gt;
&lt;br /&gt;
Below are a few examples of equivalent ExplorerScript and SSBScript code. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!ExplorerScript&lt;br /&gt;
!SSBScript&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
$CONDITION = 11621;&lt;br /&gt;
$CONDITION -= 403;&lt;br /&gt;
$CONDITION /= 8;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
flag_Set($CONDITION, 11621);&lt;br /&gt;
flag_CalcValue($CONDITION, 1, 403);&lt;br /&gt;
flag_CalcValue($CONDITION, 4, 8);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
switch($CONDITION) {&lt;br /&gt;
    case &amp;amp; 0b1:&lt;br /&gt;
        $CONDITION *= 11;&lt;br /&gt;
        break;&lt;br /&gt;
    case &amp;amp; 0b10:&lt;br /&gt;
        $CONDITION *= 22;&lt;br /&gt;
        break;&lt;br /&gt;
    case &amp;amp; 0b100:&lt;br /&gt;
        $CONDITION *= 33;&lt;br /&gt;
        break;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Switch($CONDITION);&lt;br /&gt;
CaseValue(8, 1, @label_1);&lt;br /&gt;
CaseValue(8, 2, @label_2);&lt;br /&gt;
CaseValue(8, 4, @label_3);&lt;br /&gt;
Jump(@label_4);&lt;br /&gt;
@label_1;&lt;br /&gt;
flag_CalcValue($CONDITION, 3, 11);&lt;br /&gt;
Jump(@label_4);&lt;br /&gt;
@label_2;&lt;br /&gt;
flag_CalcValue($CONDITION, 3, 22);&lt;br /&gt;
Jump(@label_4);&lt;br /&gt;
@label_3;&lt;br /&gt;
flag_CalcValue($CONDITION, 3, 33);&lt;br /&gt;
@label_4;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Turn2Direction&amp;lt;actor ACTOR_NPC_HERO_FIRST&amp;gt;(4, 10, DIR_UPRIGHT);&lt;br /&gt;
WaitExecuteLives(ACTOR_NPC_HERO_FIRST);&lt;br /&gt;
MovePositionMark&amp;lt;performer 0&amp;gt;(1, Position&amp;lt;&amp;#039;pos&amp;#039;, 58, 1&amp;gt;);&lt;br /&gt;
WaitExecutePerformer(0);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
lives(ACTOR_NPC_HERO_FIRST);&lt;br /&gt;
Turn2Direction(4, 10, DIR_UPRIGHT);&lt;br /&gt;
WaitExecuteLives(ACTOR_NPC_HERO_FIRST);&lt;br /&gt;
performer(0);&lt;br /&gt;
MovePositionMark(1, Position&amp;lt;&amp;#039;pos&amp;#039;, 58, 1&amp;gt;);&lt;br /&gt;
WaitExecutePerformer(0);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{NavScriptTerms}}&lt;/div&gt;</summary>
		<author><name>Adex</name></author>
	</entry>
</feed>