SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   Combing Page background.py (https://www.subsim.com/radioroom/showthread.php?t=210506)

Raven_2012 01-10-14 07:57 PM

Combing Page background.py
 
I never messed with Page background.py before, but my question can two be merged into one.

The reason I ask, Realistic_Hydrophone_1_1 and Speech Recognition_MiTons_NewUI_Editon_v0.4.1_english both have Page background.py

I would like a to figure out a way to make them both compatible with each other.

:ping:

Here is Realistic_Hydrophone_1_1 Page background.py
Code:

from menu import *
from RealisticHydrophone import RealisticHydrophone

def InitializeScript():
        ScriptManagerManaged.Trace( "Page background InitializeScript" )
        RealisticHydrophone.MakeSureIsLoaded( MenuPageWrapper.InitializeScript.Now )

def StartGame():
        ScriptManagerManaged.Trace( "Page background StartGame" )

def EndGame():
        ScriptManagerManaged.Trace( "Page background EndGame" )

def UnloadScript():
        ScriptManagerManaged.Trace( "Page background UnloadScript" )

And here is Speech Recognition_MiTons_NewUI_Editon_v0.4.1_english Page background.py
Code:

from SpeechRecognition import SpeechRecognition

def InitializeScript():
        SpeechRecognition.MakeSureIsLoaded( MenuPageWrapper.InitializeScript.Now )

def StartGame():
        pass

def EndGame():
        pass

def UnloadScript():
        pass

I like Speech Recognition mod and I want to try Realistic Hydrophone mod.

Mikemike47 01-10-14 08:21 PM

Quote:

Originally Posted by Raven_2012 (Post 2162597)
I never messed with Page background.py before, but my question can two be merged into one.

The reason I ask, Realistic_Hydrophone_1_1 and Speech Recognition_MiTons_NewUI_Editon_v0.4.1_english both have Page background.py

Search for JTXE enabler. Winmerge in download utilities section.

Raven_2012 01-10-14 09:01 PM

I don't have a problem merging them if I need to, I have WinMerge.

My question is it possible with these two files? Will there be errors if I do?

Quote:

Originally Posted by Mikemike47 (Post 2162606)
Search for JTXE enabler. Winmerge in download utilities section.


TheDarkWraith 01-23-14 05:26 PM

merging them is a snap:

Code:

from menu import *
from RealisticHydrophone import RealisticHydrophone
from SpeechRecognition import SpeechRecognition

def InitializeScript():
  ScriptManagerManaged.Trace( "Page background InitializeScript" )
  RealisticHydrophone.MakeSureIsLoaded( MenuPageWrapper.InitializeScript.Now )
  SpeechRecognition.MakeSureIsLoaded( MenuPageWrapper.InitializeScript.Now )
 
def StartGame():
  ScriptManagerManaged.Trace( "Page background StartGame" )

def EndGame():
  ScriptManagerManaged.Trace( "Page background EndGame" )

def UnloadScript():
  ScriptManagerManaged.Trace( "Page background UnloadScript" )

The 'from menu import *' is bad coding. You should only import what you need. No use in wasting memory :nope:

Raven_2012 01-23-14 08:48 PM

Cool, thanks! I might not use it. I haven't had to need for the Realistic_Hydrophone_1_1 Page background.py. I know I have a lot of mods enabled, mostly little ones, I figured I need to be smarter now and not go crazy with every mod. I have been getting by so far.

"If it not broke, why fix it?"

Isn't the function of the Realistic_Hydrophone_1_1 in TDW NewUI 7.4.2? Or are those buttons in hydrophone just the foundation for the Realistic Hydrophone mod? I know I tried to change the time when hydrophone man gives me messages about target following, I just get default 60 seconds.

Quote:

Originally Posted by TheDarkWraith (Post 2167073)
merging them is a snap:

Code:

from menu import *
from RealisticHydrophone import RealisticHydrophone
from SpeechRecognition import SpeechRecognition

def InitializeScript():
  ScriptManagerManaged.Trace( "Page background InitializeScript" )
  RealisticHydrophone.MakeSureIsLoaded( MenuPageWrapper.InitializeScript.Now )
  SpeechRecognition.MakeSureIsLoaded( MenuPageWrapper.InitializeScript.Now )
 
def StartGame():
  ScriptManagerManaged.Trace( "Page background StartGame" )

def EndGame():
  ScriptManagerManaged.Trace( "Page background EndGame" )

def UnloadScript():
  ScriptManagerManaged.Trace( "Page background UnloadScript" )

The 'from menu import *' is bad coding. You should only import what you need. No use in wasting memory :nope:



All times are GMT -5. The time now is 02:11 PM.

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.