Sign in to follow this  
vinniewryan

Skyrim's Script Extender basics (SKSE)

Recommended Posts

Hello, first I would like to make it known that I'm new to most types of windows application based programming. I come from a background of micro controllers and working with ram and processors that I've both chosen and decided how they should operate.

 

In the last few weeks I've started writing programs and dll's in C++ and compiling them. The major difference between what I did before and, this, seems to be the ultimately larger pool of ways to define and organize information in conjunction with the need to learn and accept using functions which I didn't write. My current understanding for c++ is great enough for me to write a program which can accomplish most things as a point-click application, but I started a project recently and got stuck early on, now I don't know where to turn in order to solve me issue.

 

The game Skyrim has a popular script extender which is capable of taking user-compiled .dll's and injecting their function into the game. Skyrim also has a less popular script extender which I've been able to understand and compile working programs with, but it's out-dated so I'm forced to move on. The old script extender allowed me to write a void main() function, then at runtime this compiled function would be loaded and executed. The new script extender has the same functionality, but there's not much documentation so I've been using the 'Go To Definition' function in VB2010 in order to debunk most of the functions. I do know this much, the extender checks all user-made dll's to see if they hold relevant information such as version info, plugin name, etc. When it determines the plugin is valid, it adds the plugin to a list of plugins to execute at runtime.

 

There is a section in the source code (open source) which initializes the main .dll for this extender, the code is as follows:

 

	BOOL WINAPI DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
	{
		switch(dwReason)
		{
		case DLL_PROCESS_ATTACH:
			SKSE_Initialize();
			break;

		case DLL_PROCESS_DETACH:
			SKSE_DeInitialize();
			break;
		};

		return TRUE;
	}

 

This makes sense to me, but it only seems to be attaching the 'script extender' to the stream, and not any of the plugins. I need help understanding where in this project file the other dll's are coming into play. There's nowhere that I can see adding a while loop to that won't mess up how the extender functions. The whole project is available for download here: http://skse.silverlock.org/

 

If anybody would care to look through it, I think you could help me understand exactly what my question is because at the moment it would be something like "where does my loop go".

 

Secondly, I noticed that when I attach a .cpp file to my program, without ever calling the functions within it, the size of the compiled dll also increases. I'm wondering if simply attaching a cpp with a main() function is enough for that code to be added to the compiled program. I know these are very noob questions, but I have a very good reason for going about learning this way, though many experienced programmers will be annoyed by this entire thread. Thanks for any help, maybe I'll still have some hair left by the time somebody replies.

Share this post


Link to post
Share on other sites

I'm a little confused about your intentions... Is it your intention to create a SKSE plugin for Skyrim? If so, after a quick glance inside the package, there appears to be an example project inside the source package (\src\skse\plugin_example) that shows you how to achieve that goal. You don't need to putz around inside SKSE's actual source code to create a plugin.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this