Skip to content

Script Formats

Robert Jordan edited this page Sep 24, 2020 · 2 revisions

CatSystem2 Script Formats

🚧 This page is a work in progress

There are many custom script/config formats in CatSystem2, and interestingly enough, they almost all run under the same basic set of rules. (even if many are ignored)

Known script formats

CatSystem2 makes use of a few different script formats, such as:

Format Ext Description
CST Scene .cst Story, dialog, scenes
FES Screen .fes Menus, windows, screens
ANM Animation .anm Frame-animations for [[HG-X Images
Definition File .dfn Config file for installers, and boot menu
Particle Script .ppi Particle effects
Motion Script ??? Motion/movement effects

Tokens

Symbol ID Kind Description
none 0x00 None None, or maybe invalid result
# 0x01 Operator Hashtag, CST variables and headers
$ 0x02 Operator
$$ 0x03 Operator Escaped '$' ?
[ \t] 0x04 Whitespace Whitespace
\n|\r\n? 0x05 Newline Newline
\\ 0x06 Operator Single backslash
other 0x07 Other No successful parse, possibly error
0[xX][0-9a-fA-F]+
[+\-]?\d+
0x? Integer Integer (unsigned hex)
Integer (signed dec)
[+\-]?\d+(\.\d+[fF]?|[fF]) 0x? Float Float
"([^\\]|\\")*" 0x? String String
'.{1,2}' 0x? Character Character (up to 0xffff)
Uses Shift JIS rules
if 0x12 Keyword If statement
else 0x13 Keyword Else statement
while 0x14 Keyword While loop
do 0x15 Keyword Do (while) loop
for 0x16 Keyword For loop
switch 0x17 Keyword Switch statement
case 0x18 Keyword Case label
range 0x19 Keyword Range ?
Possible usage in switch
default 0x1a Keyword Default label
goto 0x1b Keyword Goto statement
return 0x1c Keyword Return statement
break 0x1d Keyword Break statement
continue 0x1e Keyword Continue statement
0x1f ???
struct 0x20 Keyword Structure type definition
union 0x21 Keyword Union type definition
enum 0x22 Keyword Enum type definition
function 0x23 Keyword Function type definition
global 0x24 Keyword Global modifier
heap 0x25 Keyword Heap modifier
0x26 ???
@ 0x27 Keyword Default argument
0x28 ???
void 0x29 Keyword No type
char 0x2a Keyword Signed 8-bit integer ?
Depends on shift JIS double byte characters
byte 0x2b Keyword Unsigned 8-bit integer type
short 0x2c Keyword Signed 16-bit integer type
word 0x2d Keyword Unsigned 16-bit integer
long 0x2e Keyword Signed 32-bit integer
dword 0x2f Keyword Unsigned 32-bit integer
float 0x30 Keyword Single-precision floating type
! 0x80 Operator Logical Not
!= 0x81 Operator Not Equal to
% 0x? Operator Remainder, macros in FE Scripts
& 0x82 Operator Bitwise AND
&& 0x83 Operator Logical AND
( 0x? Operator Open parenthesis
) 0x? Operator Close parenthesis
* 0x? Operator Multiply
+ 0x? Operator Add
++ 0x? Operator Increment
- 0x? Operator Subtract
-- 0x? Operator Decrement
-> 0x? Operator Point to/Arrow
, 0x? Operator Comma separator
. 0x? Operator Dot
... 0x? Operator Ellipsis
: 0x? Operator Colon
; 0x? Operator Semicolon
< 0x? Operator Less than
<= 0x? Operator Less or Equal
<< 0x? Operator Bitwise Left shift
[ 0x? Operator Open bracket
] 0x? Operator Close bracket
= 0x? Operator Assignment
+= 0x? Operator Add assignment
-= 0x? Operator Subtract assignment
*= 0x? Operator Multiply assignment
/= 0x? Operator Divide assignment
%= 0x? Operator Remainder assignment
== 0x? Operator Equal to
&= 0x? Operator Bitwise AND assignment
` =` 0x? Operator
^= 0x? Operator Bitwise XOR assignment
<<= 0x? Operator Bitwise Left shift assignment
>>= 0x? Operator Bitwise Right shift assignment
> 0x? Operator Greater than
>= 0x? Operator Greater or Equal
>> 0x? Operator Bitwise Right shift
/ 0x? Operator Divide
? 0x? Operator Unknown usage
^ 0x? Operator Bitwise XOR
{ 0x? Operator Open brace
` ` 0x? Operator
} 0x? Operator Close brace
` ` 0x?
~ 0xa? Operator Bitwise NOT (negate)
sizeof 0xb? Sizeof Measure size of structure ?
none 0xbd ID only End of Keyword Table