Likes: 0
Results 1 to 2 of 2
Thread: [Tut] How to compile a .DLL
-
25-07-08, 01:54 AM #1
[Tut] How to compile a .DLL
Register to remove this adMade by SectorSeven
I made a video and text guide. I suggest you use them together, and refer to the video if you have questions.
Please download these files or make sure you have them before you begin:
Microsoft Visual C++ v9: http://www.microsoft.com/express/vc/
Video made by me:
http://youtube.com/watch?v=PfpLFZWNoww
Step 1: Getting the Source
The source is the .cpp where the actions and behavior of the script is defined. For this example, we will use GastricPenguin's GlobalNPC script. Here is the link to the pastebin: http://pastebin.ca/GPYPNyzR. The password is "gastric". Now that we have the source code, we need to save it as the correct file extension. Copy all the script from the pastebin page, and open up Notepad or Wordpad and paste it in. Go to File, Save As, name the file "GlobalNPC.cpp" and make sure you have "Save as type:" set to "All Files". Click the save button and close out.
Step 2: Setting Up Source Files
Create a folder on your Desktop called "GlobalNPC", exactly like that. Drag the GlobalNPC.cpp file into this folder. Now, open up the GlobalNPC.cpp file. It should open in Microsoft Visual C++ now, not Notepad or Wordpad. When we do this, we are looking for one thing, the word after the "void" statement in blue. As we look through the script, we can see that the only void statement is "void GlobalNPC". But wait, there is one that says "void SetupGlobalNPC", we will ignore this statement because it has Setup infront of it. Sometimes you will have more than one "void" statement that you will use for each script. Also, this line:
mgr->register_gossip_script(112230, gs);
is giving the NPC ID, you can change it to anything you want. However, you must do this prior to compiling the DLL.
Now that we have the statements of the script, we need to actually do the Setup files. Now, we need to get the latest "format" for our setup files. You must have Ascent compiled prior to doing this, if you don't, please stop here and compile Ascent. If you don't know how, then search for my guide on it. Browse to the "\trunk\src\scripts\src\GossipScripts" folder. Copy the Setup files in that folder to the GlobalNPC folder. You do NOT need the Makefile.am with the method that we're using to compile. We just need the Setup.cpp and Setup.h files. Open the Setup.cpp file from the GlobalNPC folder. Delete the
Code:SetupInnkeepers(mgr); SetupBattlemaster(mgr); SetupGuardGossip(mgr);
Now, we will use our void statement we got earlier "GlobalNPC". So type this line inbetween the brackets:
Code:SetupGlobalNPC(mgr);
Now open up the Setup.h file. Delete the:
Code:void SetupInnkeepers(ScriptMgr * mgr); void SetupGuardGossip(ScriptMgr * mgr); void SetupBattlemaster(ScriptMgr * mgr);
Replace this with the void statement. Once again, the portions in red will always need to be there, and the portion in blue is what you change, or the void statement.
Code:void SetupGlobalNPC(ScriptMgr * mgr);
Step 3: Setting Up Your Project File
This is an easy thing to do, just don't make it hard. Browse in your Ascent directory to: \trunk\src\scripts\projects. Now copy the "GossipScripts2008" file to your Desktop. Right click it, and go to "Open With". We are going to want to open it with Notepad or Wordpad. Now go to Edit, Replace (CTRL H). In the "Find What:" field, enter "GossipScripts". For the "Replace With:" field, we are going to enter what the name of our source file (.cpp) is, which is GlobalNPC. Hit "Replace All" and close out of that window. Now scroll down to the bottom until you see a line that has Name:"Main Recources" there. Make sure that the directories below it are set correctly in the format:
Code:srcScriptNameSetup.cpp or .h
Code:<File RelativePath="..srcGossip_Innkeepers.cpp" > </File> <File RelativePath="..srcGuardGossip.cpp" > </File>
src\ScriptNameScriptName.cpp
Make nessicary changes and then do: File, Save As, File Name: GlobalNPC.vcproj and "Save as type:" to all files. Click Save and close out.
Step 4: Compiling the DLL
Now, browse to "\trunk\src\scripts\src" and copy your GlobalNPC folder to this location. Next, browse to "\trunk\src\scripts\projects". Copy your GlobalNPC.vcproj here. Now double click GlobalNPC.vcproj and set the build to Release. If you really have compiled Ascent before, then you know what I'm talking about. Go to Build, Build Solution or hit F7. It may ask if you want to save a file, hit save, and the compiling should begin. You should either get a "1 succeeded" message or a "1 up-to-date" message.
You have just successfully compiled a DLL! It should be in your \bin\Release\script_bin\ folder.This should take about 3-4 minutes each time after you get the hang of it, so it will become much easier. If you liked my guide or video please leave comments and/or suggestions!
› See More: [Tut] How to compile a .DLL
-
25-07-08, 01:55 AM #2
Register to remove this adnice Guide , thanks for sharing and giving right credits +3 Rep
Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread
Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!
SEO Blog