that offset a is a field we'll call opcode short for operation code the opcode is always the first component of a script command and it just specifies what kind of operation to perform the opcode refers to a set of operations that the game's built-in scripting language can perform examples of opcodes include an ad which just takes two numbers and sums them and user function which allows the game to call one of many functions that exists within the games code at offset NUMBER_TOKEN is what we'll call next command pointer this field acts as a pointer to the next command that this event will execute further into the structure at offset NUMBER_TOKENc we have a unique identifier for this event as i mentioned earlier an id is placed in the id table when an event is queued however the game also stores that same id in the event itself if the id in the id table doesn't match the id in the event itself then the event does not run this check is likely implemented to avoid certain problems with running and terminating events in the queue lastly there are two floating point numbers we'll call time scale and time scheduled to run located at offsets NUMBER_TOKEN and NUMBER_TOKEN respectively skipping over the details as long as time scale and time scheduled to run sum to one or greater then the event can execute just to reiterate the game checks for valid flags id time scale and time scheduled to run only when all of those checks pass does a cued event run now let's walk through how the game actually cues events to start given the fact that we need to be able to uniquely identify events the game has a counter which tracks the next id to be assigned so let's just call this the next event id this counter is incremented every time an event is queued this way there's no fear that a given id will accidentally refer to multiple events if the game wants to queue up an event it first finds where in the queue it can place it it takes next event id and adds it to the id table and increments next event id then the game determines where in memory it can store the new event and stores an index in the index table that corresponds with this memory location event indices represent what position in memory an event is located at to find where the event is stored you first take the index and multiply by NUMBER_TOKENbNUMBER_TOKEN which is the size of one event it then adds this result with the start of the event memory region the result is the location of the desired event the game will then read the event information to determine if it should run and what script code it should execute so let's simulate what solidified gaming did by cueing a door pause hammering filling up the event queue and then unpausing when we unpause and the door event generates two additional events the ids for the additional events are actually written into the first two slots of the index table the id table and the index table are right next to each other in memory so when event ids are written past the end of the id table they are instead written to the start of the index table now that the door event ran in the first slot of the queue the game will now try to run the second event in the queue when the game does so it will associate the second id in the id table with the second index
NO_SEGMENT_TOKEN