| View previous topic :: View next topic |
| Author |
Message |
Church SUBSIM
Joined: 19 Feb 2004 Posts: 257
|
Posted: Thu Mar 31, 2005 8:44 am Post subject: Adjusting the Nearest Contact Report from the Sonar Operator |
|
|
I am trying to edit the way the sonar operator reports the nearest contact.
As you know, when he first makes a contact while submerged, he says the following:
"Sound Contact, sir! Merchant moving slow, constant distance, bearing 034! Long Range!"
What I want is when I ask for the Nearest contact, he tells me if it is long, medium or short range, along with the bearing.
in the commands menu, line 815:
815=Sound contact, sir! %s %s %s Bearing %03d! %s range!
So, I copied the "%s %s %s Bearing %03d! %s range" and placed it in the nearest contact part of the config, which is 4912:
4912=Nearest sonar contact is %s %s %s Bearing %03d! %s range, Kapitän.
What happens is when I load the game, and I submerge near a contact, the sonar operator makes the first call on the contat (815) and all is fine. Then I select the Sonar operator and I request a nearest contact report (4912), the game crashes.
So, I altered it the following way. I took part of line 4809, which is the nearest radio contact report, and I put it in and it works:
4912=Nearest sonar contact is at bearing %03.0f degrees, range %.1f Km, Kapitän!
Two issues....
1) I do not want specific information on the range. This 2nd mod will give me exact distance to the target. What I am looking for is the Long, Medium or Short range.
2) Any idea as to why one set of variables will work underwater while the second time they are asked for they crash the game?
Any help is appreciated! Thanks! |
|
| Back to top |
|
 |
Kabukiman
Joined: 27 Mar 2002 Posts: 33 Location: Germany
|
Posted: Thu Mar 31, 2005 9:17 am Post subject: |
|
|
If you were a C Software developer, you'd know why it crashes...
Let me try to explain:
Every %s or %d or %f is a placeholder for a variable.
%s is a Text-String
%d is a Integer
%f is a floatingpoint
So, when the Game reads Code 815, it expects a placeholder for 3 Strings, an Integer and another String.
When the game loads Code 4192, it expects a placeholder for a Float (and nothing more or less!).
4912=Nächster Sonarkontakt auf Kurs %03.0f Grad!
4912=Nearest sonar contact is %s %s %s Bearing %03d! %s range, Kapitän
What you do is give the Game placeholders for 4 Strings and 1 float, although the game expects just one float! Not aware of your changes, it tries to fill in that one float into the first string-placeholder -> type-mismatch -> CRASH!
You may edit the words between the placeholders (even delete them), but you may not alter the number and type of placeholders within those strings.
Code 815 is 3 Strings (%s), 1 integer (%03d, meaning show the interger with 3 digits, filled up by 0 if empty, i. e. '005' instead of '5') and another string at the end (%s).
Code 4912 is 1 float (%03.0f).
I hope I did explain it well enough for a german C-Programmer... |
|
| Back to top |
|
 |
Church SUBSIM
Joined: 19 Feb 2004 Posts: 257
|
Posted: Thu Mar 31, 2005 9:39 am Post subject: |
|
|
| that was a terrific explaination! thanks! |
|
| Back to top |
|
 |
McBeck
Joined: 23 Feb 2001 Posts: 1660 Location: Denmark
|
Posted: Thu Mar 31, 2005 11:59 am Post subject: |
|
|
| Soooo....did it work? |
|
| Back to top |
|
 |
Shockwave74
Joined: 30 Mar 2005 Posts: 229
|
Posted: Thu Mar 31, 2005 12:25 pm Post subject: |
|
|
Your explanation absolutely terrific
But in the end yes, does it work or not? |
|
| Back to top |
|
 |
rrostig
Joined: 24 Mar 2005 Posts: 65
|
Posted: Thu Mar 31, 2005 12:30 pm Post subject: |
|
|
Nice explanation, alas not totally correct.
It might be that the game gives you other variables too that you are not aware of. So maybe you can get the range and speed of the target if you find the correct order and type of variables.
It is also possible that they added some debug info that you can get to print in the text.
The problem is the game tries to access the variables and if there are none it will most certainly crash, so as long as the devs dont give out information which variables are available in which message it is pretty risky.
About working submerged but not surfaced: probably the hydrophone variables are not set when surfaced so when he tries to say it the game crashes. Probably that is the reason why he does not give out more precise information when surfaced. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|