Log in to reply
 

DLL vs CS



  • I just started scripting in C# to create some simple animations etc.
    I followed a simple tutorial where the author, on completion, just dumped the .cs file into the Scripts folder.
    I did the same and it worked exactly as expected, spawing a ped who attacked me with a crowbar.
    So I checked out some more GTA V script tutorials, again very simple ones, and this time the authors were compiling and placing the .dll instead.
    There were no external libraries in either case.
    So when do you need to build solution to create a .dll and when can you just dump the .cs file?
    thanks



  • @JohnFromGWN
    I'm sure there's more to it but one main difference is a .cs file is just one main file with the whole script where a .DLL can be made up of multiple .cs files. I've personally always just compiled and released .DLL files.
    For example, I like to put my .ini/settings for my mods in it's own .cs file to keep it separated from everything else. Just really helps with bug fixing and organization.



  • @IAmJFry Thanks for the reply. I'm just getting started and having fun in the process. This week I created about a dozen prop mods for myself, just .dds texture replaces but with maps (normal, roughness/specular, and base). Tonight I wrote my first 3 super simple scripts - adapted from tutorials. One to spawn an entity, one to play a wav file, and one to display a message (subtitle).

    Do you know any good tutorials to combine ped animations? They would be my next step. I need to find documentation on all the animations if that exists even though Visual Studio stores them from ScriptHook....that's ok for syntax but doesn't help identifying what they are and what is available.



  • @JohnFromGWN
    Nice! That's pretty much how I started. I had very little programming experience and even less with C# but just with practicing and just toying with stuff, I was able to get a better grasp of things. If you have any questions and use Discord, you can add me at IAmJFry#0097 and I can help you out there. Good luck with your modding!



  • Another reason to compile to DLL is if you need to use any external libraries. When SHVDN compiles the CS file, it only includes some basic libraries for you to use. If you want to use NativeUI, LemonUI, NAudio, etc, you must compile to DLL.



  • @Jitnaught Thanks! Makes sense. Right now, AFAIK, it will only use Forms and NativeUI (which is already installed) and itself ofc. For now I'm actually going to be tweaking simple scripts in Notepad ++, that's why Im going to search for the object model. Once I'm more comfortable I''ll go back to Visual Studio. I'm going to do some C # tutorials as well.



  • @IAmJFry That's very kind of you. I''ll very likely take you up on that offer. I'm definitely not a programmer although I know VBA extremely well so at least i have the basics to understand loops, conditions, etc.



  • One more question (well there will be more). With a CS script I can't test live. It's the painful process of closing game and reloading. I can write a few variations of the script, assign them to keys, and then see which ones work. With the dlls is it the same or can i ctrl esc back and forth between game and script. I guess what i"m asking is what is the best way to test the script in game without having to close and relaunch?



  • @JohnFromGWN
    Open your ScriptHookVDotNet.ini and set "ReloadKey" to something like Insert. (If it's not already set)
    Then while in-game, just press that key and it'll reload the scripts folder basically. So any changes you've made to that .cs / .DLL file will show in-game.



  • @IAmJFry Thanks! It was actually set to none but I didn't even know it was there. This will be great for testing purposes. Is there something similar to reload addon props for testing or will this do the trick as well?



  • @JohnFromGWN
    To be honest, I've never dealt with addon stuff.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.