Ok firstly there is something wrong with the initialisation of custom classes.
Code: Select all
GumpProto = JS_InitClass( targContext, targObject, targObject, &UOXGump_class, Gump, 0, NULL, CGump_Methods, NULL, CGump_Methods );
We only care about the last four parameters:
my_props, my_methods,
my_static_props, my_static_methods
CGump_Methods is a static array that holds function pointers (as callbacks) to the custom object.
For example if you want to create a gump you would do
var myGump = new Gump;
If you want to add a page to a gump you would do
myGump.AddPage(0);
These are "instance" functions which relate to the object.
However the exact same array is passed into "my_static_methods" parameter. Static methods are quite different than instance functions as I'm sure everyone is aware which would allow this.
Gump.AddPage(0);
This statement gets parsed fine by the javascript engine but when executes it obviously crashes. I've changed this to test the UOXCFile and it throws an error now, but it still doesn't fix the File I/O
The same applies to the "my_props" and "my_static_props" parameters too. All the custom objects are not declared correctly and this needs fixing. I'm not 100% on which methods/properties are static and which are not. I presume most of them are instance though.
This is also the case with the UOXCFile but it still doesn't fix it so the search continues