(08-16-2012, 05:14 PM)Your Computer Wrote: Namespaces are not available in the version of AngelScript that Amnesia uses. I wouldn't expect funcdef to work with methods, mostly given the name of the keyword and that methods require an instance of the class to call anyway. I haven't tried to subclass any of the classes i've made, so i'm not sure of how AngelScript handles inheritance.
Oh, right - those are instance methods! That made me try and do this (and a few other variants):
@func = @(this.MethodName);
Unfortunately, AngelScript doesn't recognize it as the name of a method - it treats it as an undeclared variable instead. Well then, I guess it's probably better to redesign the class, than to make up hackish, error-prone solutions with little (if any) value.
As for inheritance: except for certain peculiarities, it works pretty well - the benefit in HPL2 context mostly comes if you want to abstract away algorithm details, or when you use it in unison with composition to provide dynamic effects (by dynamically changing class behavior), etc.
(08-16-2012, 05:14 PM)Your Computer Wrote: I can provide a bit more insight on the private keyword, though. Private seems to enforce a void return type (at least for me), so using private on a method that returns a value won't work.
Yeah I noticed that, too. Oh well...
The way I dealt with it, if I really needed to return a value, was by using an out parameter. Something along these lines:
private void SomeMethod(string& input, int &out output) { /* ... */ }
(08-16-2012, 05:14 PM)Your Computer Wrote: P.S. It wasn't the MapView program, it was the game itself. If you load the map without any scripting errors, then modify the script and try to reload the map, you can receive errors, if any, without the game exiting.
Oh, thanks a bunch for that! I should have read the "Setting up Development Environment" wiki more carefully, I just noticed it
is explained there.