Script isn't building

Started by
25 comments, last by Jayanth Kannan 16 years, 4 months ago
I'm trying to integrate Angelscript into one fo the DX9 Samples, it's been a long time since I last used Angelscript. I had to compile the libs as a Multi-Threaded as opposed to a Multi-Threaded DLL to get it to compile with the DX Sample. then I loaded the script, Building the script crashes as it returns -1. AddScriptSection worked and I'm sure I'm passing the script properly! the script just has a main functions, so I'm sure there's no binding problems. How do I get more information about the script failure, and what could the problem be?
Advertisement
You can use asIScriptEngine::SetMessageCallback() to set a callback function that will give you information on build errors. An example for using it appears in the tutorial sample in the SDK download.
yep, got that working, but my script now isn't working. I get this error, but the PrintString function is very much there. The DX App uses Unicode, is there some probable conflict?

script (3, 5) : ERR : No matching signatures to 'print(string@&)'
Quote:Original post by Jayanth Kannan
yep, got that working, but my script now isn't working. I get this error, but the PrintString function is very much there. The DX App uses Unicode, is there some probable conflict?

script (3, 5) : ERR : No matching signatures to 'print(string@&)'


I may be interpreting your post wrong, but you're calling the function print from inside your script, so there must be a script function registered to that name.

is PrintString the in-script name of the function, or the C++ name?
maybe post the lines used to register the function as well?
Alright, I figured out all my newbie problems, got it running quite well in my game now. what is the best way to debug/trace through the script functions just as you would through say - a C++ IDE?
Debugging via breakpoints etc is complicated because that means you'd have to implement support for this in the game, i.e. an interface for displaying script code and variables etc.

Tracing however is simple, as it can be done in the background without affecting the game engine much.

The AngelScript interface is the same for both options though. I suggest you take a look at the tests/test_feature/source/test_debug.cpp test. It shows a good way of tracing the script execution by printing the execution path, complete with function names, line numbers, and variable values.

It's all done by setting a line callback on the context, and in the line callback you call the various context methods for inspecting the callstack and the variables.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

just started working with this after a long time, Nice to hear back from you Andreas - Remember me from a few years ago - from Raptor Entertainment....we had used your scripting engine in one of our games' render cycles to test performance as well as a general use throught, I'm back to using it now for more games, just getting back to it after a long time - a bit rusty right now.

Thanks for a great Library, I'll keep you posted as I use it. I just needed this feature to help out my Level designers as they'll be made to write script files as well.
Ah, Raptor Entertainment, of course I remember. You were one of the firsts to really use AngelScript. Though I believe you ended up cancelling your game, right? Instead you seem to have moved onto licensing your 3D engine. Is the XForce engine using AngelScript?

I'm glad you're coming back to AngelScript again. Let me know when you have something to show, so I can add it to the users list.

Also, don't forget to tell me if you think there is anything missing from the library. I'm still working on it constantly, so feature requests are very welcome.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

yes we cancelled our Game because we had to refocus our company strategy. We are not yet into Engine licencing as we use our Engine to develop games and products for other companies now. and yes, Angelscript is now a part of our Engine. it wasn't carried over earlier from the Game. we're in the process of the next iteration of the engine, which is why I am firm on using AS as our scripting tool.
bstr was very comfortable before, how can I get multiple strings into a bound function now?

I need it to work as multiple parameters(could be any combination)? could you explain how this is best implemented? the present implementation is like this, which compiles but doesnt work.
-------------------------------------------------------------------------------

int ScriptBinder::CreateInstance( asIScriptGeneric *gen )
/*int mesh, asIScriptGeneric *gen ,
float _11 , float _12, float _13, float _14,
float _21 , float _22, float _23, float _24,
float _31 , float _32, float _33, float _34,
float _41 , float _42, float _43, float _44 )*/
{

int mesh = *(int*)gen->GetArgPointer(0);
asCScriptString *arg1 = *(asCScriptString**)gen->GetArgPointer(1);
WCHAR wcUniqueName[BUFFER_SIZE] = L"";
mbstowcs(wcUniqueName, tempStr.c_str() , strlen(tempStr.c_str()) * 2 );

// read the Matrix
D3DXMATRIX tmp;
for(int i=2;i<2+16;i++)
tmp[i-2]=*(float*)gen->GetArgPointer(i);

return AddInstanceOfMesh( mesh, tmp, 0.0f, wcUniqueName );

}

-------------------------------------------------------------------------------
scriptengine->RegisterObjectMethod("ScriptBinder", "int CreateInstance( int mesh, const string &in, float , float , float , float , float , float , float , float , float , float , float , float , float , float , float , float )", asMETHOD(XScriptBinding, CreateInstance), asCALL_GENERIC);

-------------------------------------------------------------------------------
Error Message at as_context.cpp line 3429.
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

[Edited by - Jayanth Kannan on November 5, 2007 7:55:56 AM]

This topic is closed to new replies.

Advertisement