Basically, we wrote a format called LSF (Lacie Story File) which gets parsed into memory whenever you enter a room.
This system manages most events that happen in the game, not just the talking/dialogues.
Sadly it would be too complicated to elaborate further, as this part of the code is honestly pretty massive, but I hope it helps give you an idea!