Script isn't building

Started by
25 comments, last by Jayanth Kannan 16 years, 4 months ago
I think your problem is using asMETHOD with asCALL_GENERIC. Methods can only be bound using asCALL_THISCALL. If you want to use asCALL_GENERIC, you'll need to make it a static method. The "this pointer" can be retrieved from the asIScriptGeneric paramater.
Advertisement
I tried using THISCALL before this, All I get is an error message as indicateed. Please guide me to an explanation of how to handle parameters (single or multiple) that include strings, the way bstr used to work.
For the meantime, I'm going to switch back to using bstr. it seems to be working fine.
You would get 'The value of ESP was not properly saved across a function call' if the calling convention isn't correct.

The code snippet that you showed in the post has various problems, though it would seem to be due to mistakes when copying the code to the post, since I hardly believe the code would compile the way it is.

- You're using a tempStr variable that isn't declared. Is this a global variable? If it is, why aren't you using the string variable that you retrieved from the generic interface?
- When binding the method you're using to asMETHOD(XScriptBinding, CreateInstance), but the code above says ScriptBinding::CreateInstance. The X is different.
- asCALL_GENERIC cannot be used with asMETHOD, as it expects a global cdecl function with the following signature: void function(asIScriptGeneric *gen)

Can you post a true copy of the code that present the ESP problem? I'm pretty sure you're getting it due to incorrect registration, rather than a problem with asCScriptString itself.

I'm pleased to hear you're decided on continuing use of AngelScript.

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

I'll post the code in a while, Actually bstr works pretty fine for me, could you tell me the disadvantages of using bstr so that I may keep a lookout for the future?
There's not really any disadvantage with bstr. It's just a matter of preference. You should use whatever fits your needs the best.

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

How can I maximize the Script engine's usability. can I add new functions via AddScriptSection after a build has taken place and context has been created. It doesnt seem to be workin when I crete a new context all the earlier compiled functions are forgotten.

All I want to do is to create different functions in different files which should be a part of the same module, and every function should be available. help me with this please.
Every time Build() is called all the script sections are compiled and then removed. If you want to rebuild the module you'll have to add all the script sections again.

Note, you can add more than one script section to the module before building it.

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

Thanks. I had forgotten about this, will have to change my implementation architecture a bit.

I'm getting this error for a totally harmless function though. which seems to work fine when I call it from the CPP file instead.

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.


Any ideas why this occurs?
This happens when the function that is being called by AngelScript is not registered properly so that AngelScript doesn't call it the way the application expects. If the function expects any non-primitive types you need to check you registered those types as well as that can affect how the application expects the parameters.

Can you show me how you registered the function, and the function signature in the application?

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

This topic is closed to new replies.

Advertisement