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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 05-08-13, 10:34 AM   #11
SkyBaron
Lieutenant
 
Join Date: Mar 2010
Location: South Atlantic
Posts: 261
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
 

Tags
dbrn, favorite, new ui

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


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