Hello, *. My name is Dan and I've been making games for ages but I've always steered clear of scripting systems. That is until I started using AngelScript. I found it (almost) compiled out of the box, and implementing it in my game has been a breeze.
Having said that, I do have some issues. They are very strange to me and almost certainly my fault. I am using MSVC6 in WinXP.
Problem the first:
The angelscript says
void UpdateWorld(float dt) {
// some bs here
}
and the C++ says
asEngine->CreateContext(&context);
int functionID = asEngine->GetFunctionIDByDecl("module_dynamo","void UpdateWorld(float)");
assert(functionID>=0);
assert(context->Prepare(functionID)>=0);
and the code executes without a hitch. But then I get to using the method
// float dt=1/240th of a second
context->SetArguments(0,(unsigned long*)&dt,sizeof(float)/sizeof(DWORD));
assert(context->Execute()>=0);
I get an assert because Execute returns -1. If, however, I
RunScriptMethod("UpdateWorld(0.00416f)");
then everything is ok. Why?
Problem the second:
When I compile and run in Release mode the script is loaded and executed without error but I do not see any results of the script. For example, the UpdateWorld() is called and returns 0 but I do not see the world being updated. I have no preprocessor directives that might be changing my execution path and that includes rendering.
Problem the third:
There are many many places where I would like to get more comprehensive information from AS and, having stepped through the code, I can see that the information is being sent to various print methods. Unfortunately I have no way to specify an asIOutputStream in those places. I would love to be able to attach a single global output stream that would propagate to all associated objects.
Problem the fourth:
I tried to comile the library and the executable that uses it as multithreaded but was told of numerous conflicts with MSVCRT. I forced MSVC to ignore MSVCRT and then was told that the system could not locate __imp__strtod() and warned that several methods like assert() were both imported and exported (LNK4049). I do not know why I was getting these messages and, in the end, the only way I could compile was to change everything to single-threaded.
Problem the fifth:
I would humbly suggest that in future distros the debug build of the statically linked lib have a different name from the release build to prevent problems like trying to step into a release-built module. I have made the change on my local machine and suggest others follow suite.
Problem the sixth:
Some parts of the overview are out of date. In "Executing a script function" there is a reference to asIContext instead of asIScriptContext. There may be others! Perhaps if these pages were made into a wiki?
As I said I'm sure some of these are my fault. However, if anyone knows of what might be causing them and can lend me a hand, please do not hesitate.
[Edited by - Aggrav8d on October 22, 2004 5:30:16 PM]