Author Topic: How to properly translate script files of LSL5?  (Read 8433 times)

0 Members and 1 Guest are viewing this topic.

Offline miracle.flame

How to properly translate script files of LSL5?
« on: October 22, 2023, 09:39:38 AM »
Our team is translating the game and thanks to SCI Companion we've been able to add accented characters to fonts and translate all .tex files. However it shows there's much more text to translate and it's within the .scr files. Decompiling them, translating and recompiling seems to be the way but it fails at the very attempt to recompile the original decompiled files. Some strings easily seen in the help mode on hover over icons in top bar are lost like "Use this icon to move your character." or "Use this icon to look at things." and such. They are from n000.scr and oddly enough when decompliling everything those string are nowhere to be found in the resulting files. On the other hand using "Extract all resources" tool creates files *.scr.txt and 0.scr.txt has those strings including others from n000.scr but I can't seem to figure out how to utilize those .txt files in recompiling process.

Now I'm wondering if it's even possible to fully translate the game when the decompiled result does not contain all that's needed for full recompilation. SCI Companion seems to know how to get to those missing strings so I'm puzzled why the recompilation does not contain them. I hope I'm missing something crucial and someone here can help me figure it out.



Offline Kawa

Re: How to properly translate script files of LSL5?
« Reply #1 on: October 22, 2023, 10:01:03 AM »
I grabbed a fresh testing copy of LSL5, decompiled all, and did a "Find in Files" (Ctrl-Shift-F) for "to move your". The line helpStr {Use this icon to move your character.} was right there.

There were some mild incompatibilities like proc0_25 (aka CenterDisplay) having a (Display &rest dsALIGN 1 ... ) in it, which is forbidden by the compiler but easily resolved by slipping in a third named argument. Just that and one other slip-up and it compiled.

The bigger problem is that it wouldn't pack properly. Somehow it seemed to mistakenly build a resource.000 where it should've used resource.001, like an SCI 1.0 game would expect. And let me tell you, I am pissed as hell about that.

Offline miracle.flame

Re: How to properly translate script files of LSL5?
« Reply #2 on: October 22, 2023, 01:25:37 PM »
I have opened the game, Script -> Manage decompilation, selected all, hit Decompile and closed the manager, then Ctrl + Shift + F for "to move your" and have 0 occurences. I've also searched the contents of whole scr directory for no occurences. Any idea what's wrong?

Offline Kawa

Re: How to properly translate script files of LSL5?
« Reply #3 on: October 22, 2023, 01:37:00 PM »
Okay, I tried again with a confirmed clean copy. Pristine.

Decompiled it all, Ctrl-Shift-F "move your", and got several text results plus one script result. Main.sc, line 1129. Fixed the two errors from before, changed the text for icon0 helpStr and...

Offline miracle.flame

Re: How to properly translate script files of LSL5?
« Reply #4 on: October 22, 2023, 01:45:40 PM »
I want to believe!  :)
Any explanation to why it doesn't work here? My decompiled n000.sc (Main.sc) is 32 KB in size. Line 1129 is
      maskCel 1

Offline Kawa

Re: How to properly translate script files of LSL5?
« Reply #5 on: October 22, 2023, 01:49:15 PM »
Seems to be missing a bit. What's the rest of that general area? Mine's this, after changing the line:
Code: [Select]
(instance icon0 of IconI
(properties
view 990
loop 0
cel 0
cursor 0
message 1
signal $0041
helpStr {Hello?}
maskView 990
maskLoop 14
maskCel 1
)

Offline miracle.flame

Re: How to properly translate script files of LSL5?
« Reply #6 on: October 22, 2023, 01:50:49 PM »
1118-1135

Code: [Select]
(instance icon0 of IconI
(properties
view 990
loop 0
cel 0
cursor 0
message 1
signal $0041
helpStr 10144
maskView 990
maskLoop 14
maskCel 1
)

(method (init)
(= lowlightColor gLowlightColor)
(super init:)
)

Offline lskovlun

Re: How to properly translate script files of LSL5?
« Reply #7 on: October 22, 2023, 01:58:06 PM »
I have opened the game, Script -> Manage decompilation, selected all, hit Decompile and closed the manager, then Ctrl + Shift + F for "to move your" and have 0 occurences. I've also searched the contents of whole scr directory for no occurences. Any idea what's wrong?
You're not using an old SCI Companion, are you? There was a bug many (many!) years ago involving near text strings in properties, which would have affected precisely this.

Offline miracle.flame

Re: How to properly translate script files of LSL5?
« Reply #8 on: October 22, 2023, 02:01:02 PM »
It's v3.0.1.7 downloaded recently from http://scicompanion.com/Downloads/SCICompanion.zip

Offline Kawa

Re: How to properly translate script files of LSL5?
« Reply #9 on: October 22, 2023, 02:02:36 PM »

Offline miracle.flame

Re: How to properly translate script files of LSL5?
« Reply #10 on: October 22, 2023, 02:27:13 PM »
So I was using ancient version. You've made my day with this solution and actually a brilliant tool to work with while translating! And thank you for one of the better documentations I've seen for SCIC.

There were some mild incompatibilities like proc0_25 (aka CenterDisplay) having a (Display &rest dsALIGN 1 ... ) in it, which is forbidden by the compiler but easily resolved by slipping in a third named argument. Just that and one other slip-up and it compiled.

I can't seem to figure this out. Could you elaborate how to fix that myself? I'm getting that error while recompiling. I suppose I might stumble upon such errors in many remaining scripts.


Offline Kawa

Re: How to properly translate script files of LSL5?
« Reply #11 on: October 22, 2023, 02:48:29 PM »
In Main.sc line 557, proc0_25 has (Display &rest dsALIGN 1 etc. Now, &rest must either be the last parameter given, or be followed by an argument to start from. The fix is to change the procedure to have three arguments and provide the third for the &rest:
Code: [Select]
(procedure (proc0_25 param1 param2 theRest &tmp temp0)
(if gTheNewDialog (gTheNewDialog dispose:))
(= temp0 (GetPort))
(SetPort 0)
(Display
&rest theRest
dsALIGN
;;; etc.

The other is in rm190.sc, line 43. Brian K. Hughes wrote (sign init:) where he should've said (HollywoodSign init:). The compiler accepted it because sign was the name of a procedure, and the engine accepted it with a stumble unseen to the player (it calls the sign procedure with I suppose a numerical value for init, then ignores the result). But the end result is twofold:

1. you can't look at the sign
2. you can't properly decompile the room's init -- it becomes (proc999_0 --UNKNOWN-PROP-NAME--).

The solution is to remove that entire line with (HollywoodSign init:).

More information: https://github.com/scummvm/scummvm/commit/c7743b3422d6b95cb9252d01f69b75c76278faaf

Offline miracle.flame

Re: How to properly translate script files of LSL5?
« Reply #12 on: October 22, 2023, 02:57:06 PM »
Thank you so much for all your help today and for your dedication to SCI. You're making a better world.
Now off I go translating...

Offline Kawa

Re: How to properly translate script files of LSL5?
« Reply #13 on: October 22, 2023, 02:59:12 PM »
Have fun storming the castle 👋

Offline miracle.flame

Re: How to properly translate script files of LSL5?
« Reply #14 on: October 31, 2023, 12:40:19 PM »
I'm back with all .sc files translated and I need to ask. Why is it that after recompiling original files without any changes the talker in introduction scene is renamed from Vinnie to Vinnie_b or from Bruno to Bruno_b? Is there a way to prevent this? If not what is the proper and most effective way to fix it manually? I mean how to identify all the instances of such renaming and how to know what was it originally...?


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

Page created in 0.098 seconds with 23 queries.