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 05-08-13, 01:14 AM   #9931
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by SkyBaron View Post
That explains it! Thanks for letting me know. In any case I wanted to try my hand at writing a C# .dll for sh5 and I can start by creating a sound dll (maybe similar to the one you made) it'll be good for compatibility with other UIs, and I'll also learn in the process!. I've seen a few C# DirectSound implementations online and they don't look too difficult (I'm not a professional programmer, but I find it very interesting).

I wanted to ask you a couple of technical questions. I'm playing around with the menu editor/scripting, trying to learn more stuff, and I wanted to know if any of these are possible:

1 - When I create a button and use its ".Clicked" property, the mouse click event is called when the mouse button is released. Is there a way to get a mouse event as soon as the user presses down the button instead of only when it is released? I've seen dials that do that, but I'm not sure if it's doable with buttons.

2 - I tried to create an EditBox to input some text, but they seem to be limited to 30 characters or something like that. Is there a way to increase this limit?

Thanks!
Writing a DirectSound wrapper for Python isn't too difficult. The catch with ANY DLL loaded by a script in SH5 is disconnecting the DLL from the game. You'll understand what I mean when you begin getting CTDs when a function in your DLL tries to do a callback to a function in a python script of the game

I'm pretty sure there are OnMouseDown and OnMouseUp events from the ScriptManager of the game. Those might not be the exact commands but I know something of the likes exists. The catch, one again, is they only exist for the left mouse button. Nothing exists for the right mouse button or the scroll wheel (or any of the other buttons on the mouse). That is why I wrote my own Mouse wrapper for the game The callbacks thing I spoke about earlier and CTDs will become VERY apparent if you try to write a mouse wrapper. Another problem with writing a mouse wrapper is do you constantly poll for button presses or do you use AutoResetEvents to signify a mouse event happened? If the latter then you will have some difficult problems overcoming CTDs from the callbacks to your python functions (it's doable but it's very tricky! I use AutoResetEvents and a dedicated thread for this)

EditBoxes character limit IIRC is 256 or 0xFF (I remember seeing that in the code about them). I've been using EditBoxes for quite some time in my UIs mod and have never had a problem with them only being a limited few number of characters as you describe. They are a strange animal as you'll find out when you try and use them

Besides the events InitializeScript, UnloadScript, GameStart, and GameEnd there are some other events you can hook into in the Python scripts. I ran across the available events yesterday while scanning over some of the SH5 code. I book marked that area to come back to later.
TheDarkWraith is offline   Reply With Quote
Old 05-08-13, 10:34 AM   #9932
SkyBaron
Lieutenant
 
Join Date: Mar 2010
Location: South Atlantic
Posts: 262
Downloads: 673
Uploads: 2
Default

Quote:
Originally Posted by TheDarkWraith View Post
Writing a DirectSound wrapper for Python isn't too difficult. The catch with ANY DLL loaded by a script in SH5 is disconnecting the DLL from the game. You'll understand what I mean when you begin getting CTDs when a function in your DLL tries to do a callback to a function in a python script of the game
Do you mean SH5 just "forgets" that there was a .dll imported? So if I have a dll with a method Add(n1, n2) returning n1+n2 to the script it will CTD?

Quote:
I'm pretty sure there are OnMouseDown and OnMouseUp events from the ScriptManager of the game. Those might not be the exact commands but I know something of the likes exists. The catch, one again, is they only exist for the left mouse button. Nothing exists for the right mouse button or the scroll wheel (or any of the other buttons on the mouse). That is why I wrote my own Mouse wrapper for the game The callbacks thing I spoke about earlier and CTDs will become VERY apparent if you try to write a mouse wrapper. Another problem with writing a mouse wrapper is do you constantly poll for button presses or do you use AutoResetEvents to signify a mouse event happened? If the latter then you will have some difficult problems overcoming CTDs from the callbacks to your python functions (it's doable but it's very tricky! I use AutoResetEvents and a dedicated thread for this)

EditBoxes character limit IIRC is 256 or 0xFF (I remember seeing that in the code about them). I've been using EditBoxes for quite some time in my UIs mod and have never had a problem with them only being a limited few number of characters as you describe. They are a strange animal as you'll find out when you try and use them

Besides the events InitializeScript, UnloadScript, GameStart, and GameEnd there are some other events you can hook into in the Python scripts. I ran across the available events yesterday while scanning over some of the SH5 code. I book marked that area to come back to later.
After reading your comment I looked for Down/Up strings and actually found MouseLeftButtonDown and MouseLeftButtonUp, that's exactly what I needed. About the editbox, the menu editor didn't add the line "TextMaxLen=xxx" to the .ini file, I solved the length problem by adding it manually.
__________________


SkyBaron is offline   Reply With Quote
Old 05-08-13, 02:08 PM   #9933
mainexpress
Ensign
 
Join Date: May 2005
Location: San Francisco home of the U.S.S. Pampanito
Posts: 220
Downloads: 294
Uploads: 0
Default

When i open up the options file editor viewer V1.0.28.0 TDW...i dont see the tabs running across the top...all it says is file what install path do i set this too...so i can see all the tabs across the top...so i can make my tweaks?
mainexpress is offline   Reply With Quote
Old 05-08-13, 02:30 PM   #9934
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by mainexpress View Post
When i open up the options file editor viewer V1.0.28.0 TDW...i dont see the tabs running across the top...all it says is file what install path do i set this too...so i can see all the tabs across the top...so i can make my tweaks?
Point it to the file \data\Scripts\Menu\TheDarkWraithUserOptions.py of the mod (or whatever file that is a copy of that file that you want to modify)
TheDarkWraith is offline   Reply With Quote
Old 05-08-13, 02:35 PM   #9935
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by SkyBaron View Post
Do you mean SH5 just "forgets" that there was a .dll imported? So if I have a dll with a method Add(n1, n2) returning n1+n2 to the script it will CTD?
No, it doesn't forget. You imported it via the script thus it's in memory. Here's the problem with importing DLLs and having functions of that DLL callback into script code: If the callback simply calls straight into script code there is a high probability that the game will CTD (maybe not the first, maybe not the second time, you never know when). Thread safe isn't the correct word this but the game isn't synchronized for this. Your callback needs to call a function in script code that will take the information needed and say to the game "Hey, I have some information I need to process when you're ready". Then when the game is ready it calls your function (in script code) to process that information. It's like callback to a callback in a way
TheDarkWraith is offline   Reply With Quote
Old 05-08-13, 03:18 PM   #9936
VacantName
Seaman
 
Join Date: Jan 2010
Location: A long, long way from Tipperary
Posts: 40
Downloads: 60
Uploads: 0
Default

I'm probably an idiot and doing something incredibly obvious wrong, but I can't get this mod working. I extracted it to my mods folder and went to activate it with JSGME. Didn't have a clue what most of the options there were (IE WWIII Interface, Das Boot Crew Mod, Alt Officer Injured By Torpedo, etc) but figured they sound like optional extras, so just activated 'New_UIs_TDC_7_3_0_ByTheDarkWraith' (along with the other mods I wanted) and entered the game. My UI is just the vanilla one.

So I exited and had a poke around thinking perhaps the thing I need to activate is hidden away in a subfolder somewhere and needs moving. Couldn't find it. Next I had a search on this here internet machine and found both a thread and a youtube vid on the matter of adjusting the option file. Maybe I'm misunderstanding something, but from what I could gather it sounds like leaving it as it is should give me the EnhancedSH5 UI, but it doesn't, as I said I just get vanilla. So now I'm stumped.

TBH I'm not all that bothered about the UI as I don't mind the vanilla one so much but there's a couple of the add-on bits I'd like to make use of (namely Real Navigation and the thing that allows me to intercept radio messages) and I'm guessing (again I may be wrong) that I need the UI working to run those....

So can anyone tell me where I've gone wrong?
VacantName is offline   Reply With Quote
Old 05-08-13, 04:04 PM   #9937
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by VacantName View Post
I'm probably an idiot and doing something incredibly obvious wrong, but I can't get this mod working. I extracted it to my mods folder and went to activate it with JSGME. Didn't have a clue what most of the options there were (IE WWIII Interface, Das Boot Crew Mod, Alt Officer Injured By Torpedo, etc) but figured they sound like optional extras, so just activated 'New_UIs_TDC_7_3_0_ByTheDarkWraith' (along with the other mods I wanted) and entered the game. My UI is just the vanilla one.

So I exited and had a poke around thinking perhaps the thing I need to activate is hidden away in a subfolder somewhere and needs moving. Couldn't find it. Next I had a search on this here internet machine and found both a thread and a youtube vid on the matter of adjusting the option file. Maybe I'm misunderstanding something, but from what I could gather it sounds like leaving it as it is should give me the EnhancedSH5 UI, but it doesn't, as I said I just get vanilla. So now I'm stumped.

TBH I'm not all that bothered about the UI as I don't mind the vanilla one so much but there's a couple of the add-on bits I'd like to make use of (namely Real Navigation and the thing that allows me to intercept radio messages) and I'm guessing (again I may be wrong) that I need the UI working to run those....

So can anyone tell me where I've gone wrong?
Is JSGME installed correcly? You should either unzip it into the C:\Ubisoft\Silent Hunter 5 folder, or configure it for working with SH5

Also make sure that you have enabled the correct folder of NewUI's:

NewUIs_TDC_7_3_0_TheDarkWraith.7z => NewUIs_TDC_7_3_0_TheDarkWraith\MODS\NewUIs_TDC_7_3_0_TheDarkWraith

Drop the orange folder into the C:\Ubisoft\Silent Hunter 5\MODS folder, and enable it using JSGME.
gap is offline   Reply With Quote
Old 05-08-13, 04:38 PM   #9938
mainexpress
Ensign
 
Join Date: May 2005
Location: San Francisco home of the U.S.S. Pampanito
Posts: 220
Downloads: 294
Uploads: 0
Default

Quote:
Originally Posted by TheDarkWraith View Post
Point it to the file \data\Scripts\Menu\TheDarkWraithUserOptions.py of the mod (or whatever file that is a copy of that file that you want to modify)
okay when i open up options file editor..click on file then set path to menu.txt...i look for that menu file to point it too in TDW UI's data/scripts/menu and it's not there but when i open up the folder without options file editor...i see it
mainexpress is offline   Reply With Quote
Old 05-08-13, 04:41 PM   #9939
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by mainexpress View Post
okay when i open up options file editor..click on file then set path to menu.txt...i look for that menu file to point it too in TDW UI's data/scripts/menu and it's not there but when i open up the folder without options file editor...i see it
If you want the changes to be permanent then use the mod's path. If you want the changes to last until you disable the mod then use the path I gave you (which would require the mod being enabled in JSGME)
TheDarkWraith is offline   Reply With Quote
Old 05-08-13, 04:54 PM   #9940
VacantName
Seaman
 
Join Date: Jan 2010
Location: A long, long way from Tipperary
Posts: 40
Downloads: 60
Uploads: 0
Default

Quote:
Originally Posted by gap View Post
Is JSGME installed correcly? You should either unzip it into the C:\Ubisoft\Silent Hunter 5 folder, or configure it for working with SH5

Also make sure that you have enabled the correct folder of NewUI's:

NewUIs_TDC_7_3_0_TheDarkWraith.7z => NewUIs_TDC_7_3_0_TheDarkWraith\MODS\NewUIs_TDC_7_3_0_TheDarkWraith

Drop the orange folder into the C:\Ubisoft\Silent Hunter 5\MODS folder, and enable it using JSGME.
So I'm looking for a file called "NewUIs_TDC_7_3_0_TheDarkWraith" inside a folder called "NewUIs_TDC_7_3_0_TheDarkWraith" inside another folder called "NewUIs_TDC_7_3_0_TheDarkWraith"? My head hurts but I'll give it a go
VacantName is offline   Reply With Quote
Old 05-08-13, 05:11 PM   #9941
THE_MASK
Ace of the deep .
 
THE_MASK's Avatar
 
Join Date: Jan 2006
Posts: 9,226
Downloads: 901
Uploads: 73


Default

Look at the second picture to see what the file structure should look like .
http://www.subsim.com/radioroom/showthread.php?t=192374
THE_MASK is offline   Reply With Quote
Old 05-08-13, 05:32 PM   #9942
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by VacantName View Post
So I'm looking for a file called "NewUIs_TDC_7_3_0_TheDarkWraith" inside a folder called "NewUIs_TDC_7_3_0_TheDarkWraith" inside another folder called "NewUIs_TDC_7_3_0_TheDarkWraith"? My head hurts but I'll give it a go


More or less, may I correct you?

you are looking for a folder called "NewUIs_TDC_7_3_0_TheDarkWraith" inside a folder called "MODS" inside a folder called "NewUIs_TDC_7_3_0_TheDarkWraith" inside a 7z archive called "NewUIs_TDC_7_3_0_TheDarkWraith"
gap is offline   Reply With Quote
Old 05-08-13, 09:43 PM   #9943
mainexpress
Ensign
 
Join Date: May 2005
Location: San Francisco home of the U.S.S. Pampanito
Posts: 220
Downloads: 294
Uploads: 0
Default

Quote:
Originally Posted by TheDarkWraith View Post
If you want the changes to be permanent then use the mod's path. If you want the changes to last until you disable the mod then use the path I gave you (which would require the mod being enabled in JSGME)
Okay with the mod enabled New UIs_TDC_730 i open the path you gave me data/scripts/menu i see two folders menu and stations which are both empty and no txt document to point the options view editor...but when i just open the folder without the options view editor i see the notepad or txt document. and the two folders menu and stations...which have there respective files in those folders.
mainexpress is offline   Reply With Quote
Old 05-10-13, 06:12 AM   #9944
Psycho_Yuri
Watch
 
Join Date: Mar 2013
Location: The Netherlands
Posts: 15
Downloads: 34
Uploads: 0
Default

Hi,

What are the functions of these, what exactly is going to happen with these when I use them?

Report contacts
Send Contact reports
Send patrol report
Send weather report
Report nearest radio contact
Psycho_Yuri is offline   Reply With Quote
Old 05-11-13, 05:23 AM   #9945
Gillian81
Watch
 
Join Date: Sep 2010
Posts: 20
Downloads: 12
Uploads: 0
Default

Hi all,

Is it possible to re-enable the torpedo solution lines. The ones with the 1, 2, 3 numbers?
So you know when to shoot your torpedo.

I know this isn't a very realistic option, but I like to use it, since I'm not that good yet in this game.
Gillian81 is offline   Reply With Quote
Reply

Tags
dbrn, favorite, new ui


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:41 PM.


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.