This is a modified version of AGS Editor. I have performed a very small modification in the RegisterScriptHeader and UnRegisterScriptHeader methods, as mentioned in the title. Here it is in more detail:
Changes in this version:
A small change in the RegisterScriptHeader and UnRegisterScriptHeader methods in
NativePlugin.cs. A new class named ScriptMerger has been added for this purpose and the two
methods in NativePlugin.cs have been slightly modified.
THIS CHANGE WILL AFFECT ONLY THOSE PLUGINS WHICH REGISTER THEIR SCRIPT HEADER IN THE METHOD
DESCRIBED BELOW. Other plugins will remain unaffected.
IMPORTANT NOTE:
THERE IS NO CHANGE IN THE AGS PLUGIN API. ONLY THE OPERATIONS PERFORMED BY THE EDITOR WHEN
THE RegisterScriptHeader AND UnRegisterScriptHeader METHODS ARE CALLED FROM THE PLUGIN HAVE
CHANGED.
A more detailed description:
The ScriptMerger class is used to merge the struct member definitions from the header registered
by the plugin with the built in AGS header. This allows the plugin to define new members for
structs/enums. THIS IS APPLICABLE ONLY FOR AGS's BUILT-IN TYPES.
For example, assume that some plugin registers a header as below:
managed struct Room
{
import static int GetTimesVisited();
};
Then the declaration of GetTimesVisited will be added into the declaration of Room struct in AGS's
built-in script header, i.e. it will be available as a member function of Room object in scripts.
Similarly for enums.
The newly added function can be used in scripts in the following way:
int timesVisited = Room.GetTimesVisited();
if(Room.GetTimesVisited() > 5)
... and so on.
The plugin should register the GetTimesVisited function as:
_lpEngine->RegisterScriptFunction("Room::TimesVisited^1", <address of method here>);
in the plugin's AGS_EngineStartup method.
Why was this done?
This change was done mainly because unlike scripts, extender functions are not available to
plugins. This code change started out as an attempt to see whether this issue could be somehow
handled at the editor end.
So, if any plugin has to add new functionality to a built in object (e.g. the Room object above),
then the plugin author has to create the necessary script functions through the plugin and the
extender functions have to be implemented through a separate script module.
One more advantage of this approach is that it allows the plugin author to add static functions
to the built in objects (such as the hypothetical GetTimesVisited mentioned above). This cannot
be done through extender functions or any scripting techniques.
Issues/Limitations/TODO:
The change has not been thoroughly tested, but should work for most situations. USE AT
YOUR OWN RISK.
See the enclosed readme file for details.
Download here (http://www.mediafire.com/?ej88wwo3uv0ch). Note the self extracting archive contains both the binaries and sources.
Edit: Updated download link
Update 29 Mar 2011: Updated with new editor build made from latest code from SVN.