Skip to content

ThpsQScriptEd\Opcode Reference

DCxDemo edited this page Apr 6, 2024 · 13 revisions

Return to ThpsQScriptEd

qScript opcode reference table

Value Name Game support Comment
0x00 Terminator THPS3 End of the script
0x01 Line feed THPS3 End of the line (stores no additional values. Used in later games.
0x02 Debug line feed THPS3 End of the script (stores additional debug int value) ). Used in earlier games.
0x03 Struct THPS3 Struct opening bracket
0x04 End Struct THPS3 Struct closing bracket
0x05 Array THPS3 Array opening bracket
0x06 End Array THPS3 Array closing bracket
0x07 Equals THPS3 Equals operator (=)
0x08 Property THPS4 Class property accessor
0x09 Comma THPS4 Array elements separator
0x0A Subtraction THPS4 Math: subtraction (-)
0x0B Addition THPS4 Math: addition (+)
0x0C Division THPS4 Math: division (/)
0x0D Multiplication THPS4 Math: multiplication (*)
0x0E Condition THPS4? Used in condition checks
0x0F End condition THPS4? Used in condition checks
0x10 Reserved? ?
0x11 Reserved? ?
0x12 Less than THPS4 Math: <
0x13 Less than or equal THPS4 Math: <=
0x14 Greater than THPS4 Math: >
0x15 Greater than or equal THPS4 Math: >=
0x16 Hash symbol THPS3 Any variable/struct/array name etc.
0x17 Integer THPS3 An integer number
0x18 Reserved? ?
0x19 Reserved? ?
0x1A Float THPS3 A float number
0x1B String THPS3 Raw text data
0x1C Param string? THPS3 ?
0x1D Reserved? ?
0x1E Vector THPS3 A three dimensional vector (0,0,0)
0x1F Pair THPS3 A two dimensional vector (0,0)
0x20 Begin THPS3 Repetition loop opening bracket
0x21 Repeat THPS3 Repetition loop condition
0x22 Break THPS3 Repetiton loop break
0x23 Script THPS3 Script opening bracket
0x24 End Script THPS3 Script closing bracket
0x25 If THPS3 If clause opening operator
0x26 Else THPS3 If clause otherwise operator
0x27 Else if THPS3 If clause else if operator
0x28 End if THPS3 If clause closing operator
0x29 Return THPS4? Script termination operator
0x2A Reserved? ?
0x2B Hash symbol table entry THPS3 A debug feature, stores Hash symbol/string key/value pair in the file. Can be omitted in "release" mode, but must be present in case prefix checking funcs are used in THPS3.
0x2C All parent script params THPS3 Operator used to pass all parent script params (<...>)
0x2D Parent script param THPS3 Operator used to pass a single param ()
0x2E Jump THPS3 Jump operator within the random clause. (@)
0x2F Random THPS3 Defines random code branching based on following jump operators
0x30 Random Range THPS3 Returns random float value between the given range
0x31 Reserved? ?
0x32 Or THPS4? Logical addition (OR)
0x33 And THPS4? Logical multiplication (AND)
0x39 Not THPS4? Logical negation (NOT)
0x3C Switch THPS4? Switch clause opening operator
0x3D End Switch THPS4? Switch clause closing operator
0x3E Case THPS4? Switch clause condition operator
0x3F Default THPS4? Switch clause default branch operator
0x47 If jump THUG2 If clause opening operator with the jump offset
0x48 Else jump THUG2 If clause otherwise operator with the jump offset
0x49 End switch jump? THUG2 Switch clause closing operator with offset??