EvilEngine/SCRP
SCRP | |
---|---|
Script | |
Type | Base |
Base Type | 0x2A |
Games used | Night of 100 Frights Battle for Bikini Bottom |
Source code | zScript.h |
A script is essentially a timeline of events. It contains a list of events that are set to play at specific times after the script has started running.
To start running a script, send the Run event to it. When a script is finished sending its events, it will send Expired to itself. You can also send Expired to the script to manually stop it. You must send either Reset or ScriptReset to the script before you can run it again. ScriptReset is essentially a faster version of Reset, because it doesn't go through the process of resetting the entire script object, just the script's internal state.
Scripts can also be instructed to pause execution, with the WaitForInput event. When a script receives this event, it will stop executing events until the player presses the Y button (GameCube/Xbox) or Triangle button (PS2), then it will pick up sending events from where it left off.
Scripts also have a Start Time setting, which allows you to set a time offset that the script will seek to when it starts running. Any events set before the Start Time will not be run. This can be useful for debugging, other than that there's not much practical use for this setting.
AR Codes and Patches for Scooby and BFBB
Scripts were not officially supported in Heavy Iron games until The SpongeBob SquarePants Movie, but there is leftover code for Scripts present in Scooby-Doo!: Night of 100 Frights and Spongebob Squarepants: Battle for Bikini Bottom. However, neither of these games process SCRP assets by default. For the PlayStation 2 and GameCube versions, AR codes are required for Scripts to function correctly. However if you plan on using the Xbox versions, IPS patches intended to be applied to the default.xbe executable file for either of the two games are necessary for Scripts to function correctly (note that both these methods remove support for ITEM assets, another unused asset type found in both games):
Scooby-Doo! Night of 100 Frights
- Add SCRP support (GameCube NTSC)
040d1c24 41820044 041b6d68 53435250
- Add SCRP support (PlayStation 2 NTSC)
2027DFF0 10830011 20298E60 53435250
- Add SCRP support (Xbox NTSC)
Mod |
---|
Add SCRP support Scooby Xbox NTSC |
Battle for Bikini Bottom
- Add SCRP support (GameCube NTSC)
0428a998 53435250 040b5590 41820044
- Add SCRP support (PlayStation 2 NTSC)
20405850 53435250 2019c680 10830011
- Add SCRP support (Xbox NTSC)
Mod |
---|
Add SCRP support BFBB Xbox NTSC |
Format
xScriptAsset
xScriptAsset is the data structure that defines the format for SCRP assets. It inherits from xBaseAsset (8 bytes long).
SCRP assets store an array of xScriptEventAssets at offset 0x14, followed by its array of links.
Offset | Type | Variable | Description |
---|---|---|---|
0x08 | float | scriptStartTime | Start time offset in seconds. Always 1 in TSSM. |
0x0C | int | eventCount | Number of xScriptEventAssets. |
Not present in BFBB | |||
0x10 | byte | loop | Always 0 or 1 |
0x11 | byte | padding[3] | Always 0 |
xScriptEventAsset array offset = 0x14 | |||
Link array offset = 0x14 + 0x20*eventCount |
xScriptEventAsset
xScriptEventAsset defines the format for timed events in SCRP assets.
Offset | Type | Variable | Description |
---|---|---|---|
0x00 | float | time | Time of event in seconds, relative to the time the script starts running. |
0x04 | AssetID | widget | Asset to send this asset to. |
0x08 | int | paramEvent | Event ID enum. (See the list of events for your game to find the correct event ID) |
0x0C | float[4] | param | Event parameters (can be floats, ints, AssetIDs, etc.) |
0x1C | AssetID | paramWidget | Asset ID parameter. |
0x20 | int | enabled | Only present in ROTU |