SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 11-10-10, 10:41 PM   #16
Obelix
Seasoned Skipper
 
Join Date: Aug 2010
Location: 49°44´N 129°40´E
Posts: 665
Downloads: 124
Uploads: 7
Default

I don't understand why this thread isn't sticky? I have long used the search, when accidentally discovered this thread. I think this is an important thread. Here I learned a lot about tools for SH5. Prior to that, once again had to worry modders and tear them away from important matters
Thank's for this tutorial.
__________________
Speed squadron is the speed of the slowest ship ... but only so long as on the trail of the squadron did not sit submarines ...

Last edited by Obelix; 11-10-10 at 11:26 PM.
Obelix is offline   Reply With Quote
Old 11-11-10, 03:23 AM   #17
Zedi
Sea Lord
 
Join Date: Mar 2010
Posts: 1,845
Downloads: 184
Uploads: 2
Default

It's not sticky maybe because is another tutorial dealing with the same thing made by karamazovnew here

Anyway.. I agree, all TEC and tutorial should be sticky as every bit of info about moding is important.
Zedi is offline   Reply With Quote
Old 11-11-10, 03:46 AM   #18
Obelix
Seasoned Skipper
 
Join Date: Aug 2010
Location: 49°44´N 129°40´E
Posts: 665
Downloads: 124
Uploads: 7
Default

Quote:
Originally Posted by Magnum View Post
... by karamazovnew here
Hm! This thread was all the more necessary to make a sticky. Thank you for link.
__________________
Speed squadron is the speed of the slowest ship ... but only so long as on the trail of the squadron did not sit submarines ...
Obelix is offline   Reply With Quote
Old 11-11-10, 09:49 AM   #19
Captn Wilhelm
A-ganger
 
Join Date: Oct 2010
Posts: 73
Downloads: 55
Uploads: 0
Default

This is great!! Thank you for the tutorials!
Captn Wilhelm is offline   Reply With Quote
Old 05-05-13, 04:23 PM   #20
Jace11
Seasoned Skipper
 
Join Date: Mar 2005
Location: UK
Posts: 683
Downloads: 104
Uploads: 1
Default

Does anyone have the original files still?

Im trying to make my own TDC and running into syntax problems with the .py scripts. Im using notepad++ and checking and double checking but alas, I keep having problems with the script to call a basic TDC page on the attack periscope....

Any help would be appreciated. I've removed every space, checked tabs and it all looks fine in notepad++.
Jace11 is offline   Reply With Quote
Old 05-05-13, 04:25 PM   #21
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default

Try dropping a message in Reaper7's PM box
gap is offline   Reply With Quote
Old 05-05-13, 05:03 PM   #22
Jace11
Seasoned Skipper
 
Join Date: Mar 2005
Location: UK
Posts: 683
Downloads: 104
Uploads: 1
Default

Tracked down in debugger to line15 column 1, looked at some other scripts and figured it out.

# Globals

ShowTDC = True

#Page attack periscope.py

from menu import *

def InitializeScript():
[TAB] Menu.PageActivated += Menu_PageActivated
[TAB] Menu.PageDeactivated += Menu_PageDeactivated
[TAB] Menu_PageActivated( Pageattackperiscope )

def StartGame():
[TAB] pass

def Menu_PageActivated( page ):
[TAB] if page == Pageattackperiscope:
[TAB] [TAB] global ShowTDC
[TAB] if ShowTDC:
[TAB] [TAB] from PageTDC import PageTDC
[TAB] [TAB] PageTDC.Visible = True

def Menu_PageDeactivated( page ):
[TAB] if page == Pageattackperiscope:
[TAB] [TAB] global ShowTDC
[TAB] if ShowTDC:
[TAB] [TAB] from PageTDC import PageTDC
[TAB] [TAB] PageTDC.Visible = False

def EndGame():
[TAB] pass

def UnloadScript():
[TAB] Menu.PageActivated -= Menu_PageActivated
[TAB] Menu.PageDeactivated -= Menu_PageDeactivated

should globals be double "tabbed"? it works now but then the TDC stays when I exit station

the indentations listed in the tutorial seem wrong to me...

Last edited by Jace11; 05-05-13 at 05:36 PM.
Jace11 is offline   Reply With Quote
Old 05-06-13, 02:39 PM   #23
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

the python file layout controls flow of execution. If something is tabbed more or tabbed less than it should be the python execution engine will throw an error. Your example above would throw an error. If the global ___ is to be part of the function block then it needs to be tabbed the same as the function block.

If you've done any coding in C++ or C# think of the tabs as {}s. Think of the : as function header

C#:

private void myfunction(int a, float b)
{
a = Convert.ToInt32(b);
}

In python:

def myfunction(a, b):
[TAB]a = Convert.ToInt32(b)

Last edited by TheDarkWraith; 05-06-13 at 03:03 PM.
TheDarkWraith is offline   Reply With Quote
Old 06-24-13, 06:51 PM   #24
machiavelli
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Quote:
Originally Posted by reaper7 View Post
Hi I have been trying for the last few weeks to get my head around using the Editor and scripting to create useable object ingame for Modding.
I was getting nowhere fast till ThedarkWraith stepped in and offered me his help. I have used his expertise advice to create a Tutorial on getting started with Modding for Silent Hunter 5 via the use of The Built in Menu Editor, editing of cfg files and the generation of script files.

Most of the work here is from TheDarkWraith checking and correcting the work I was doing to learn these steps.
I have decided to do up what I've learned so far in the hope it well help others that were in the same situation as me (Banging there heads and getting nowhere fast).

First This is available to download in PDF format here: The PDF version includes some notes on top of Pics to show whats going on.
(Not in the online version)
http://rapidshare.com/files/367306675/Adding_Items_in_the_SH5_Editor_Tutorial.pdf
Also the files that were created in this tutorial are availabe here also:
http://rapidshare.com/files/367307917/Tutorial_Files.rar

Now then on to the Tutorial:



Adding Dial’s via the Menu Editor


Adding a single dial is a very simple evolution. If you want to teach yourself how do this:

using the Menu Editor: We want to add the heading/rudder dial to PageTDC.

In Page layout find the Heading group (it's under Group feedback)





Now copy its entire tree over to PageTDC. ( You can right click on Heading and select Copy then right click on Page TDC and select Paste.)
Now when I say the entire tree I'm talking about its anchor group. What denotes an anchor group? The big 'G' in the box. For heading it's 'Heading'. Now if you just copy over heading and think you got a dial you are wrong.
The 'whole' dial consists of 'Heading' - a Group, 'Rudder' - a Group, 'Toggle Rudder Heading Around' - a button, and 'Toggle Rudder Heading' - a button.
How do I know this? Two ways. One is that when I click on each one I get a yellow outline box on the editor that shows me graphically that it's part of the whole dial. Two, as I click on each one in the menu editor and I look in the zone section I see that the anchor refers to some part of the dial (it doesn't have to but doing so keeps the coherency of the object). You'll notice that the button 'Toggle Rudder Heading' anchor is 'Bkgr'.




You should end up with 2 Groups Rudder and Heading and 2 Buttons (Bt) Toggle Rudder Heading and Toggle Rudder Heading Around.
Now after you've copied all those items over to PageTDC you need to check their anchors. You'll notice that 'Toggle Rudder Heading' anchor is set to Null now. Why? Well before it referenced an item in Page layout but we're now in PageTDC so obviously that page doesn't exist here.



I would set the 'Toggle Rudder Heading' anchor to the object on PageTDC that you want this dial to be anchored to. Best thing to do is set the anchors of all the copied objects to reflect the values of the object you copied from in the other page. After setting all the anchors to the values they should be, moving the 'Toggle Rudder Heading' will cause the whole dial to move with it (if all the anchors are setup to reference one another in the object). If one of the anchors is set to reference some other object then that part won't move when you move 'Toggle Rudder Heading'.



Okay so now we have a new dial on PageTDC. But how do we get the game to update it? That's the easy part. Go back to the page you copied this new dial from. I'll use the Heading/Rudder here as an example. For the game to update a dial it needs 3 pieces of information: the dial, the current value, and the new value. Open up the file \data\Menu\cfg\Dials.cfg.



This is where we define the dials. Do a search for 'CompassFdbk'. This dial, [Dial22] is responsible for updating the 'Heading' dial in Page layout. How do I know this? Easy. Look at the values for CrtVal (current value), NewVal (new value), and Dial.
They start with 3F (0x just means this is a hex value). If we go back to the menu editor and go to Page layout we see that its ID is 3F000000.
If we find the values for CrtVal, NewVal, and Dial on Page layout we see that they reference objects of the dial in question (parts of the Heading dial).



Now if you correlate the CrtVal, NewVal, and Dial to the objects on the screen you can see what is controlling what. After you denote the correlation then add another entry to Dials.cfg at the bottom. Copy the whole entry for [Dial22] to the bottom and give it the next number in the chain (if you're using the stock file the next number will be 75. Now change the CrtVal, NewVal, and Dial IDs on this new entry to reflect the IDs of the dial on PageTDC.



But wait we're not done yet !!!
This dial has two states - Heading and Rudder. We have to create another entry in Dials.cfg. But what is this entry? Well I know that rudder needs to look like the entry [Dial21] (RudderFdbk). So copy the whole entry for [Dial21] to the bottom of Dials.cfg and give it the next number in the chain (would be 76 with stock file).
Now these names - RudderFdbk, SpeedFdbk, etc. can be anything you want to call them for your new dials. Change the IDs of the new dial entry to reflect the object in PageTDC (parts of the Rudder dial).



Don't forget to change the Dials.cfg's top number 'DialsNo=' to one plus the last entry in the chain of dials (its zero based). For our example that line should read 'DialsNo=77'. Save the file.



So far we have only edited 2 files:
Page TDC.ini - (\data\Menu\PagesPage TDC.ini) and Dials.cfg - (\data\Menu\cfg\Dials.cfg).
You can back these up into another folder for use in your own Mod.

Now before we can see our newly placed dial on screen we need a way for the page to tell the TDC to load up. To do that were going to need the help of Scripting.



End of Part 1


Hi, perhaps I'm missing something. Where can I find the menu editor? You said it comes with the game. Where at exactly?

Thanks.
  Reply With Quote
Old 06-24-13, 07:06 PM   #25
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

check your \documents\sh5\data\cfg\main.cfg file. There a header called Modding. There's an entry called MenuEditor. This needs to be set to true.
TheDarkWraith is offline   Reply With Quote
Old 06-24-13, 08:04 PM   #26
machiavelli
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Got it thanks. Wow, you guys have it easy over here with menu edits. I was hoping it was an external .exe file that I could use in sh3 as well.
  Reply With Quote
Old 05-23-16, 03:30 AM   #27
MrWild
Nub
 
Join Date: May 2016
Posts: 3
Downloads: 19
Uploads: 0
Default

Hi!

I`m trying to find as much information on modding SH as possible. This thread is very interresting to me.
But the links to the .pdf and archive seems to be broken ( I would be very grateful if you could share these files.

P.S. Sorry for my English
MrWild is offline   Reply With Quote
Reply

Tags
dials, editor, scripting, tutorial

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.