Community

SCI Programming => SCI Syntax Help => Topic started by: hrvg on October 31, 2018, 04:06:53 PM

Title: Police Quest 1 VGA
Post by: hrvg on October 31, 2018, 04:06:53 PM
Hello,
I translated "Police quest 1 VGA" in French. But, I have a problem. When driving vehicles. It is "MPH" and not "KM". I found the file where it is write "%d MPH". I translated MPH -> KM. But, not the speed by 5: 5, 10, 15, 20, etc... I do not find how to change 5 by 10. For have: 10, 20, 30, etc. I searched with this code: 83c005. I do not have this code in the game. I do not know how to use dosbox debugger. SCICompanion does not work for this game. I would like to know if it is possible to modify (change) the number "5" by "10", thank you? It is possible or not, thanks?
Title: Re: Police Quest 1 VGA
Post by: Kawa on October 31, 2018, 05:39:01 PM
SCI Companion most certainly does work for this game, and you don't need the DOSBox debugger for this.

Though it's certainly possible to convert from MPH to KM, it's... pretty much spread over the script file, with various values in MPH, and a graphical element that has the correct cel set by math based on a speed in MPH.

I can see that the changeSpeed Script instance changes the speed value (local9) by fives, at least.

Also, as the screenshot shows, there is no "%d MPH" -- those are two separate strings, "%d" and "MPH" ;)
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 01, 2018, 04:56:16 AM
Hello Kawa,
I thank you for your quickly answer.

I do not understand. It is technical.
I open PQ1VGA game with SCICompanion. I click on "Debug game" button. I have this message:
Quote
Timed out trying to start debugging functionality. This requires a compatible template game.

I only want to modify the speed x: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65 MPH, which is displayed in game window... Change (modify) x: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 and 130 MPH (KM)
If it is possible.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 01, 2018, 07:37:46 AM
That's not how Debug Game works, haha.

Again, you can change the speeds as you describe, but even the single added multiplication would require recompiling from an .sc file.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 01, 2018, 07:57:48 AM
I have 500.scr file. But I do not know what (how) to change (modify) in this file.
Someone explained to me that I could find "string" to edit with a debugger.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 01, 2018, 08:51:45 AM
What you'll want to do is decompile the .scr file into a human-readable .sc file, giving you what was in my screenshot. Then you can find the routine that draws the speed on screen, where you changed the "MPH" to "KM", and add a multiplication in there. Recompile, hope for the best, and it might work out.

In fact, here. Catch. I haven't tried to play this, but here's a 500.scr/hep with that multiplication added.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 01, 2018, 09:12:33 AM
Super, It is excellent ! I tested with the 3 cars... It is good. I thank you very much for your help.  :)
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 01, 2018, 12:47:33 PM
I put PQ1 VGA online:

https://www.abandonware-forums.org/forum/autres/les-aventuriers-de-la-traduction-perdue/778763-police-quest-1-vga-en-fran%C3%A7ais/page2

Thank you very much for your help.  :)
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 08, 2018, 11:12:06 AM
Hello,
I would like to translate "Police Quest 3."
I examined game (play).
I found two problems for the moment:
My first problem...
These are the active keys on the keyboard.
Files:
199.p56 (perhaps), 200.p56, 201.p56. 811.v56, 197.v56. No 199.scr, 811.scr, 197.scr files. I found 200.scr and 201.scr files.
I looked for these keys:
Computer 200.p56.
Home:
D, H, P, T, Q
DMV
D, V, P, Q
Homicide
R, N, S, Q
Personnel
Q 17

The car computer 199.p56:
D, V, P, F, Q

I looked for these codes in the files: 200.scr, 201.scr, 203.scr, 204.scr, 205.scr and 255.scr.


C /  3 / 03 // MAJ 67 / 43 // MIN  99 / 63
D /  4 / 04 // MAJ 68 / 44 // MIN 100 / 64
F /  6 / 06 // MAJ 70 / 46 // MIN 102 / 66
H /  8 / 08 // MAJ 72 / 48 // MIN 104 / 68
N / 14 /  E // MAJ 78 / 4E // MIN 110 / 6E
P / 16 / 10 // MAJ 80 / 50 // MIN 112 / 70
Q / 17 / 11 // MAJ 81 / 51 // MIN 113 / 71
R / 18 / 12 // MAJ 82 / 52 // MIN 114 / 72
S / 19 / 13 // MAJ 83 / 53 // MIN 115 / 73
T / 20 / 14 // MAJ 84 / 54 // MIN 116 / 74
V / 22 / 16 // MAJ 86 / 56 // MIN 118 / 76

I did not find these "actives" keys.
How do I change active keys, please?


My second problem.
This problem is same as for "Police Quest 1 VGA". This is speedometer in MPH. But, in this game the speed is real. The speedometer goes up to 100 MPH.
@ Kawa
You made me two files (500.hep and 500.scr) for "Police Quest 1 VGA" ...
In this game, I did not find the files (except file "25.p56" where speedometer is displayed). I suppose 25.scr file shows speed.
You could change (modify) MPH speed in KM, please.
1 MPH = 1.6 KM (1 mile = 1.6 km). I thank you.
I am going to abuse your patience, but it is possible to do the same correction on 500.hep and 500.scr files for Police Quest 1 VGA?

Thank you for your help.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 08, 2018, 01:15:06 PM
Okay, first of all? If it's 1.6 kilometers to a mile, we're gonna have a problem here cos the system only allows integers. So no decimal points. Also, a bunch of parts of 25.scr can't be decompiled and remain as assembler code that I dare not touch.

(https://twemoji.maxcdn.com/2/72x72/1f645-200d-2640-fe0f.png)

(Edit: I may have a German version that may or may not use km. If it does, it might be possible to copy whatever is different)

Second, view 197 does indeed contain menu items and such with hotkeys, like "DMV". Looking in rm200.sc, I see this:
Code: [Select]
(instance Dmv of Prop
(properties
x 26
y 10
view 197
priority 15
signal $1800 ;(| skipCheck noTurn)
)

;<cut>

(method (handleEvent pEvent &tmp [temp0 2])
(if (not (& signal $0080)) ;actorHidden, but that's not in sci.sh
(switch (pEvent type?)
(evKEYBOARD
(if
(or
(== (pEvent message?) KEY_d) ;<-- that's it. that's the part we want to change!
(== (pEvent message?) KEY_D) ;in both upper and lower case.
(and
(== (pEvent message?) KEY_RETURN)
(proc255_5 self pEvent)
)
)
(self loop: 1) ;highlight the item
(Animate (gCast elements?) 0) ;show it
(self loop: 0) ;and go back to the regular pic
(Animate (gCast elements?) 0)
(global2 newRoom: 204) ;now go to the DMV screen
(pEvent claimed: 1)
)
)
There's remarkably similar things for the other menu items, each with their own Props.

If you can manage to decompile the game, you can retrace these steps and make the edits you need.

I am not looking forward to PQ2.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 08, 2018, 02:33:55 PM
I thank you for your answer.
I apologize, sorry. Because I explained myself badly. The speed is displayed by 5 miles (as in Police Quest 1 VGA).
5 miles = 8 Km. I watch Spanish and German versions. It is in MPH. But, the speedometer does not display MPH (only speed)... So, it is not a problem. I am stupid man, sorry.

 
Quote
Second, view 197 does indeed contain menu items and such with hotkeys, like "DMV". Looking in rm200.sc, I see this:

There's remarkably similar things for the other menu items, each with their own Props.

If you can manage to decompile the game, you can retrace these steps and make the edits you need.

I decompiled the game. I will watch tomorrow. Thank you for your help.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 09, 2018, 08:01:35 AM
I can not find these letters. I looked in the Deutsch and Spanish versions. I do not understand. Where to find these letters.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 09, 2018, 11:43:13 AM
In the German version, it uses this to determine if you pressed D for DMV, or W for Wagen:
Code: [Select]
(== (pEvent message?) (proc932_2 100 119))
(== (pEvent message?) (proc932_2 68 87))
The decompiler can't tell what those numbers are, so you don't get KEY_d and such. Looking in keys.sh, we see that KEY_D is $44, and KEY_d is $64. That's 68 and 100 respectively. Working backwards we can see that the other numbers are KEY_W and KEY_w. So proc932_2 is "return either this value or the other one depending on our current language".
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 09, 2018, 02:39:04 PM
I did not understand your message, sorry:

Quote
If you can manage to decompile the game, you can retrace these steps and make the edits you need.

Because it's very technical for me.

Ok, I did "Manage decompilation" with Deutsch and English versions.

For DMV in keys.sh file:
d = 64//100, D = 44//68
w =  77//119, W = 57//87

(Load°rsVIEW°(proc932_2°197°1971))
(Dmv
view:°(proc932_2°197°1971)
x:°(proc932_2°26°30)
init:
)
° It is not the good sign, It is a black point.

1971 It is 1971.v56 for Deutsch version.

I do not understand "26°30" in "proc932_2°26°30".

There is no 811.v56 file in Deutsch version. Everything is in 1971.v56 file.

If I write this:

(Load°rsVIEW°(proc932_2°197))
(Dmv
view:°(proc932_2°197)
x:°(proc932_2°26°30)
init:
)

Active key will be "W, w" and not "D, d"?

I will continue tomorrow... My old brain will explode!
Thank you for your patience and help.
Title: Re: Police Quest 1 VGA
Post by: troflip on November 09, 2018, 02:56:22 PM
Handy tip: you can use the ` character to represent values for keys, instead of KEY_D KEY_d. For instance:

Code: [Select]
(== (pEvent message?) (proc932_2 `d `w))
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 09, 2018, 03:09:47 PM
Yeah but the observed problem here is that the decompiler didn't know those were supposed to be keys.

And what is even up with the ° everywhere? It's so messy, it makes me not want to help.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 09, 2018, 04:10:05 PM
For °:
° -> It is a black point (See screenshot)... I do not have this key on my keyboard, sorry.

(https://zupimages.net/up/18/45/pk56.png) (http://zupimages.net/viewer.php?id=18/45/pk56.png)
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 09, 2018, 04:46:36 PM
Oh, visible whitespace! Okay... don't do that, please. It made your last post horrible.

Quote
I do not understand "26°30" in "proc932_2°26°30".
So yeah in context that'd be
Code: [Select]
(Load rsVIEW (proc932_2 197 1971))
(Dmv
view: (proc932_2 197 1971)
x: (proc932_2 26 30)
init:
)
(see how nice that looks like that?)

I already said that proc932_2 returns one value or the other, depending on the current language. Because the menu items change in length when translated, their X positions must be adjusted. So this does the following:
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 10, 2018, 10:55:22 AM
I tried this.
I made Manage decompilation. I checked (ticked) "Select All". Then decompile.
I open rm200.sc file.
I replaced W (87) -> X (88) and w (119) -> x (120).
I wrote this:                     
(== (pEvent message?) (proc932_2 100 120))
(== (pEvent message?) (proc932_2 68 88))
I made Save. I play game. W/w keys are active and not X/x.
I make Compile. I do not have any more mistakes. I play game. W/w keys are active and not X/x.
I make Compile all. I play game. W/w keys are active and not X/x.
I make Rebuild resources. I play game. W/w keys are active and not X/x.
I renamed rm200.sc file -> 200.scr. I play game. The game crashes.
Where is my mistake, please.
PS:
I understood for "26 30". Thank you.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 10, 2018, 11:17:46 AM
Ok, I think I found my mistake, sorry. Thank you for your help.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 10, 2018, 11:20:40 AM
Your first mistake was to try and play the game without clicking Compile first.
Your last mistake was renaming the source file.

When you tested the change, did you use a savegame? If yes, was that savegame made while already using the computer? Because the savegame includes all the bytecode for the currently-loaded scripts. Regardless, did you actually switch the game from English to... I guess French?
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 10, 2018, 11:50:44 AM
Quote
When you tested the change, did you use a savegame? If yes, was that savegame made while already using the computer? Because the savegame includes all the bytecode for the currently-loaded scripts. Regardless, did you actually switch the game from English to... I guess French?
You are right.
I know this problem of script files. I translated the texts into these files and that have pointers. I lost several hours understanding why the translation did not appear in the game. I thought about pointers. But, it was as you say.

For my error, I did not modify (transalte) 197.v56 and 811.v56 files. Because DMV is difficult to translate. It does not exist in France. And I did my tests on the Deutsch version and I did not translate the 1971.v56. And I did not think that the drawing of the letter (W/w -> X/x) had a role for the active keys. I tried by chance and it worked. I tried with letter (Z/z). And it works.
I thank you for your patience and help.
My brain will be able to rest.  :)
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 10, 2018, 07:45:11 PM
You'll notice in the German version, "DMV" is translated to "Wagen". "Car", not  "AKF" ("Abteilung für Kraftfahrzeuge", as in "Department of Motor Vehicles") So why not go with "Voiture"?
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 11, 2018, 06:48:26 AM
I delete this message because it is not important. Sorry.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 11, 2018, 08:44:31 AM
Please learn to format your posts :(
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 11, 2018, 08:55:11 AM
No problem with Deutsch version. But useless for me, because I translate English version.
English version.
My tries (tests):
A)
(== (pEvent message?) KEY_s)
(== (pEvent message?) KEY_S)
No error. But  no work
B)
(== (pEvent message?) (proc932_2 100 115))
(== (pEvent message?) (proc932_2 68 83))
I compile. 155 and 156 lines... Error: (rm200.sc) Unknown procedure 'proc932_2' .  Line: 156, col: 40
http://zupimages.net/viewer.php?id=18/45/jrzx.png
C)
(== (pEvent message?) (proc932_2 `d `s))
(== (pEvent message?) (proc932_2 `D `S))
I compile. 155 and 156 lines... Error: (rm200.sc) Unknown procedure 'proc932_2' .  Line: 156, col: 39
D)
(== (pEvent message?) (proc932_2 'd 's))
(== (pEvent message?) (proc932_2 'D 'S))
I compile. 155 and 156 lines... Error: (rm200.sc) Unknown procedure 'proc932_2' .  Line: 156, col: 39
Same error as C). I do not this sign `
E)
Spanish version
(== (pEvent message?) (proc0_20 100 115))
(== (pEvent message?) (proc0_20 68 83))
I compile. 155 and 156 lines... Error: (rm200.sc) Unknown procedure 'proc0_20' .  Line: 155, col: 38
F)
I inserted these Deutsch files in the game that I translate (English version): 200.scr, 197.v56 and 1971.v56.
The game crashes.
I do not understand. Where is my mistake, please?
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 11, 2018, 11:16:43 AM
The English version doesn't have any of the multilanguage functions. It doesn't have a proc932_2 for you to call. So test A is actually the only one that could work.

I'll notice you didn't say you compiled in test A.


And again, format your posts, please. They're hard to read.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 11, 2018, 12:41:05 PM
Quote
And again, format your posts, please. They're hard to read.
I am sorry. My English is very bad. I try to write short and simple.
Quote
I'll notice you didn't say you compiled in test A.
Yes. I compile and I do not have error. But It does not work.
If I do "Compile all". I have two errors:
Error: (egoActions.sc) signal is a property.  Only one parameter may be supplied.  Line: 65, col: 9
Error: (Sync.sc) Undeclared identifier '--UNKNOWN-PROP-NAME--' .  Line: 133, col: 23
121 scripts compiled.

I will translate 197.v56 and 811.v56 files. Because these files are complex to translate in French.It is not impossible, but I must to find short words with the first letter different for each word.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 11, 2018, 12:45:27 PM
So if you hit Compile, you get no error yet it doesn't work...

Do you test this with a saved game? If you do, is this saved game made while already using the computer? Because as before, that'll just restore and use the old code. You'd have to leave that screen and use the computer again to load your edited version that looks for the other keys.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 11, 2018, 03:06:33 PM
Quote
So if you hit Compile, you get no error yet it doesn't work...
Yes, It does not work.

Quote
Do you test this with a saved game? If you do, is this saved game made while already using the computer? Because as before, that'll just restore and use the old code. You'd have to leave that screen and use the computer again to load your edited version that looks for the other keys.

Yes, I know this problem.
That is what I did:
I modified 197.v56 file. I changed the letter D from "DMV" to S (no MV letters). I saw that D letter was used several times for: Driver's ID and Composite Drawing (I have not changed the D letters.)
So, I changed T letter of "Tools" by O. There is only once the active letter O.
http://zupimages.net/viewer.php?id=18/45/yjzt.png

I made "Export as patch file" in game folder. I made "Open game" (resource.map). I opened "rm200.sc".
I modified:
(== (pEvent message?) KEY_d) --> (== (pEvent message?) KEY_s)
(== (pEvent message?) KEY_D) --> (== (pEvent message?) KEY_S)
(== (pEvent message?) KEY_t) --> (== (pEvent message?) KEY_o)
(== (pEvent message?) KEY_T) --> (== (pEvent message?) KEY_O)
I compile and not error.
http://zupimages.net/viewer.php?id=18/45/an1k.png

I click on "Run Game" in SCICompanion.
I click on "Skip it" in game.
I play... I click on S/s or O/o. It does not work.

So, I made "Open game" (resource.map) and I click on "Run Game" in SCICompanion. Or with DosBox 0.74 in my game. Same, It is always D/d and T/t letters, not S/s and O/o.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 11, 2018, 04:27:34 PM
Look man. I don't know what to tell you. I changed the key constants from D to S, pressed Compile... made the intro go from the Sierra logo to the computer interface because I'm not gonna go through all that...

I run the game, watch the Sierra logo go straight to the computer interface... I press S and got the DMV interface.

Video proof:
https://www.youtube.com/watch?v=lOVzBNtQtQE (https://www.youtube.com/watch?v=lOVzBNtQtQE)
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 11, 2018, 05:09:04 PM
I do not understand... It works with you... And it does not work with me!!! I am amazed.
I know I am bad at IT (computer)... But I am not stupid (though, I am wondering). I am sending you my decompiled game as I make the changes.


Tomorrow, I am doing a clean game.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 11, 2018, 05:36:33 PM
Ok, I just made a "new" clean game with the game that I translate... And it works. I do not understand anything... Why the game did not work with the old game!!
Thank you for your help.
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 11, 2018, 06:06:02 PM
I'd say with all the random, ill-informed attempts to get it to work, you may have ended up with a copy of 200.scr in the game directory, still set to respond to D presses. Its presence would overrule any other versions of script 200 in the main resource file.

And that's why a new, clean game has it work correctly right away.

But that's just a theory.
Title: Re: Police Quest 1 VGA
Post by: Charles on November 11, 2018, 11:43:49 PM

I made "Export as patch file" in game folder.

I think this step was your problem. It sounds like you “Export[ed] as patch file” before compiling. That extracted the original script 200 from the resource.000 and saved it as a 200.scr “patch” file.

When you later compiled the script it updated within resource.000, but Sierra games always give priority to external “patch” files if they exist. So the game was always loading the original script it found in the exported 200.scr ignoring the updated script in resource.000, exactly like Kawa described.

By the way, I think the effort you’re putting into your translation work is awesome, and I wish you all the best for it.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 12, 2018, 04:24:31 AM
200.scr file was not in the "new" game folder, because I had removed it to try 200.scr Deutsch file.
I did not extract the files in Deutsch game. That may be why the hotkeys worked.
When I read your messages. I looked in the "new" game folder and 200.scr file was not there. So I handed the 200.scr file.. And it did not work anymore. It was my error.
Thank you for your help.

@ Charles, I thank you for your encouragement.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 12, 2018, 12:32:38 PM
Ok, finish. Thank you for your help. How I can to have modified .scr files? Because I put "resource.000" file in my game folder... My game does not start. I put "resource.001, resource.002, resource.003 and resource.004" files in my game folder... My game does not start. Thank you.


PS:
I did "Rebuild resources". Then I made "Extract all resources" in a blank folder. And I take the files: 200.scr, 201.scr, 202.scr, 203.scr, 204.scr, 205.scr and 255.scr. I put these files in my game folder (translation). It is good. It works. I would like to know if I made a mistake?
Title: Re: Police Quest 1 VGA
Post by: Kawa on November 12, 2018, 02:34:45 PM
When you save an edited resource, it's added onto the end, leaving the original version behind. Those would be the ones marked "unused" in the list. "Rebuild resources" takes all the latest resources from all volumes (each resource.### being a separate diskette, and a single resource.000 usually being a CD release) and builds a fresh new resource.000 file with them. resource.map tells which resources there are and on which volume they can be found.

For example, in Space Quest 3, you'll see there's three separate copies of Roger's regular sprite, all view.000, marked as being on volume 1, 2, and 3. As it happens, SQ3 came on three diskettes and Roger can be seen walking around on all three. View 7, the shadow he casts in the red tunnel at the beginning, is only on volume/disk 1. That comes out to 251 view resources spread out over three volumes, including duplicates. Altogether, SQ3's resource volumes are 1.82 MB in size. If I were to click "Rebuild resources", this would be reduced to 186 views across one single volume file that's only 1.30 MB. You can see that all the system scripts (everything >900) is also duplicated on all volumes/diskettes.

If your game uses separate heap resources, you really want to extract and include the hep resources for each scr you changed or its proper functionality can't be guaranteed.
Title: Re: Police Quest 1 VGA
Post by: hrvg on November 12, 2018, 03:10:05 PM
Quote
If your game uses separate heap resources, you really want to extract and include the hep resources for each scr you changed or its proper functionality can't be guaranteed.

I did "Rebuild resources" to get .scr files (200.scr, 201.scr, 202.scr, 203.scr, 204.scr, 205.sc and 255.scr) for the changes in my game. It works, but I'm at the beginning of the game. If I understand you, I did something that makes the game unstable?

Title: Re: Police Quest 1 VGA
Post by: troflip on November 12, 2018, 03:37:32 PM
"Rebuild resources" doesn't make .scr files. .scr files are created when you extract a compiled script resource.

(does not apply if you're using "Manage resources as patch file" in the "Game properties" dialog, but I don't think that's available in the official SCI Companion release).

Title: Re: Police Quest 1 VGA
Post by: hrvg on November 12, 2018, 04:15:50 PM
I did "Rebuild resources"... Then I did "Extract all resources" to have 200.scr, 201.scr, 202.scr, 203.scr, 204.scr, 205.sc and 255 .scr files. For the moment, my game works.

Quote
(does not apply if you're using "Manage resources as patch file" in the "Game properties" dialog, but I don't think that's available in the official SCI Companion release).
Yes, I have this function. But my brain is overheating. I will watch tomorrow because I broke more than 10 games today... I have recovered everything, but it is getting late.