Skip to content

ThpsQScriptEd\Compatibility

DCxDemo edited this page Apr 6, 2024 · 3 revisions

Return to ThpsQScriptEd

Known bugs and unimplemented stuff

  • random inside another random - aka random(@random(@x @y) @z)
  • newer thug+ random
  • thug2+ ifs with offset
  • thug2+ endswitch?

QB compatibility mode

Unfortunately, while most THPS games are using the same qScript, it evolved over time and some new features were added, making new scripts incompatible with older games.

  • THPS3 has the most limited support and the most basic set of opcodes. while some opcode were reserved for specific operations, they were not implemented yet.
  • THPS4 introduced math operators (+, -, *, /, <, >, =>, >=), comma separators, switch/case clause, etc. Basically, all the stuff meant to be there from the beginning.
  • THUG changed binary format of Random clause.
  • THUG2 introduced additional if/else clause with offsets.

WARNING, this feature wasn't implemented properly QScripted analyzes imported script and sets the compatibility level of current script. This also affects the way some specific opcodes (like random) will be saved to QB. User can (and should) track current script level by checking the bottom right corner of the application. It is only updated on import/export. If user works with a specific game, it is recommended to change Minimum QB mode to the corresponding value. It will ensure that correct export options for the game are chosen.

Please note that this only tracks script level on the opcode level. It doesn't check if a function exists in traget game exe or if you're passing correct params, etc. Synctatically correct script is not guaranteed to work in the actual game as there are more factors.

Clone this wiki locally