View Single Post
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