Module Development > The Forge - Mod Development

[WB] Warband Script Enhancer v3.1.5 (18/12/2012)

<< < (2/529) > >>

GetAssista:
Woah!

How does it work internally?

Lumos:
This looks like a must-have for when I start modding Warband... Great work.

cmpxchg8b:

--- Quote from: GetAssista on December 27, 2010, 10:32:09 AM ---Woah!

How does it work internally?

--- End quote ---
1) the loader forces Warband to load the WSE library
2) in certain parts of the original code the WSE library redirects program flow to handler functions
3) lots of abstraction and c++ code
4) eventually program flow is redirected back into the original code (not necessarily in the same part)

Changing behavior of Warband functions requires lots of low-level work, while adding new operations is fairly trivial now that some sort of "framework" is in place. For example, the str_equals operation looks like this:
(click to show/hide)
--- Code: ---#include "WSEPluginAPI"

bool StringEquals(WSEScriptingContext *context)
{
RglString str1, str2;

context->GetString(str1, 0);
context->GetString(str2, 1);

return !strcmp(str1.text, str2.text);
}

//CUT: other operations

void WSEStringOperations::Init(WSEOperationProvider *provider)
{
provider->RegisterOperation(2600, "str_equals", "Fails if <string_1> is not equal to <string_2>", StringEquals, Cf, 2, 2,
"string_1", String, "string_2", String);

//CUT: other operations
}

--- End code ---

GetAssista:

--- Quote from: cmpxchg8b on December 27, 2010, 03:13:33 PM ---2) in certain parts of the original code the WSE library redirects program flow to handler functions
3) lots of abstraction and c++ code
4) eventually program flow is redirected back into the original code (not necessarily in the same part)

Changing behavior of Warband functions requires lots of low-level work, while adding new operations is fairly trivial now that some sort of "framework" is in place.

--- End quote ---
Woah #2!  This is just awesome  :idea:
What kind of WB generated data do you have access to in #2? Can it be used for some more indepth actions like operating agents/props?

cmpxchg8b:

--- Quote from: GetAssista on December 27, 2010, 03:47:26 PM ---What kind of WB generated data do you have access to in #2? Can it be used for some more indepth actions like operating agents/props?

--- End quote ---
Technically, everything in the game can be accessed and modified. However, I must know the layout of data structures and memory addresses of methods.
I don't know much about either scene prop instances or agents yet, but it's only a matter of time (could be a very long time, though).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version