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-11-10, 03:23 AM   #1
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   #2
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   #3
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   #4
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   #5
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   #6
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   #7
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
Reply

Tags
dials, editor, scripting, tutorial


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 02:23 AM.


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