Author Topic: Altering message files and creating patches with SCI  (Read 1868 times)

0 Members and 1 Guest are viewing this topic.

Offline amcparty

Altering message files and creating patches with SCI
« on: November 14, 2023, 05:18:20 PM »
Hi, I've been having quite a bit of strange issues when it comes to editing message files. For example, if I try to change the verb value on a line of dialogue, the change doesn't seem to take effect properly and I've even run into instances where the line ends up playing loudly and distorted. Does anyone have experience editing these kinds of files? For what it's worth, the game I'm looking at is King's Quest VI.



Offline Kawa

Re: Altering message files and creating patches with SCI
« Reply #1 on: November 14, 2023, 05:38:53 PM »
First, message resources are loosely coupled to audio resources -- you take the module/noun/verb/case/sequence numbers, calculate a hash number for it, and if there's an audio resource with the same number, that's what gets played. And it's exactly the same with lip syncing for that audio.

Therefore, if you only edit a single value in a message resource, there's no real reason for the audio to completely break beyond SCI Companion maybe being overly eager to help, perhaps because by changing a verb value you've changed that line's hash and SCI Companion feels a need to adjust the audio samples to match. And it might be messing up at that point. If it didn't try to do these things, the worst you could expect is that you'd hear an entirely different line, or none at all.

But all this is me theorizing really hard before I go to bed so take it with a grain of salt.

Just to be sure, you might want to check if you're using the latest version of SCI Companion. The one on scicompanion.com is somewhat outdated. If nothing else, the latest version (available from the link below in my signature) has reference support so you don't get mysterious blank entries where a line has multiple different nouns/verbs/etc.

Offline amcparty

Re: Altering message files and creating patches with SCI
« Reply #2 on: November 14, 2023, 06:07:59 PM »
Thanks for the reply.

The build of SCI Companion that I'm using is the one I pulled from your bio not too long ago.

If I click on a line of dialogue and change its verb value, things appear to be fine when I go to save the changes. However, if I close the file window and reopen it, the line now has a red sound icon and it tells me that the levels have been clipped. Playing the file will give me a loud distorted mess. Do I need to make changes to the map file in order for the game to recognize what I've changed? I tried repackaging the sounds thinking that might solve the problem, but no luck.

When I load up the game and test the change, it seems to have only half worked. The text appears correctly, but no sound at all will play.
« Last Edit: November 14, 2023, 06:14:14 PM by amcparty »

Offline Kawa

Re: Altering message files and creating patches with SCI
« Reply #3 on: November 15, 2023, 03:56:08 AM »
Concerning. This ought to be looked into.

But until then you can edit the messages manually: export the one you want to edit to a .msg file, then use something like my Utf8Message tool to edit it as a plain text file, convert it back to .msg, and import it into SCI Companion again.

Don't let the tool's name fool you.

Offline amcparty

Re: Altering message files and creating patches with SCI
« Reply #4 on: November 15, 2023, 12:29:22 PM »
Hmm, I tried doing what you suggested. I extracted the msg file, converted it with your tool and got a txt file, changed one verb value, and converted it back to msg. After importing the file back in, the sound that was linked to the text is just completely missing now. Testing it in-game results in the text showing up properly, but still no sound.

Offline Kawa

Re: Altering message files and creating patches with SCI
« Reply #5 on: November 15, 2023, 01:58:22 PM »
Yeah, cos the audio is keyed to the old verb.

Let's take this example from Freddy Pharkas:

Module 0, noun 0, verb 1, case 0, sequence 1. Talker 99, the Narrator: "That's just another bit of authentic Western scenery."
This hashes to 00000001.001, so the Audio36 resource (not to be confused with regular non-talkie audio) is @00000001.001. Playing that in SV matches.

If I were to extract and edit 0.msg to have this line be verb 2, looking at something generic would print a "message not found" fallback. Talking to it would print "that's just another bit of authentic Western scenery"?... but it'd say "you can't think of anything to say to that." That's @00000002.001.

Because messages and talkie audio are loosely coupled.

All of this wouldn't be quite as much of a problem if SCI Companion worked better with preexisting Audio36 resources. Again, something to look into.

(?: even though the original "talk" line is still there and has the same key as our edited "look" line, which incidentally is kinda forbidden, the engine would find and return the altered "look" line first.)

Offline amcparty

Re: Altering message files and creating patches with SCI
« Reply #6 on: November 15, 2023, 04:59:18 PM »
Gotcha. So, after changing the verb value and repackaging the audio files to generate the folder with all the room's audio hash files, I pulled the specific one tied to the new verb and it seems to have worked. Dropping the corresponding hash file and msg file into the game's root folder will patch in the change as desired.

Kind of a goofy workaround to get it working, but it did the job. Thank you for your help!
« Last Edit: November 15, 2023, 06:41:46 PM by amcparty »


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.038 seconds with 23 queries.