Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Dec 2001
Offline Last Active Oct 02 2012 02:02 PM

Topics I've Started

Keep script running

22 January 2009 - 02:20 AM

Hello, Final question for quite a while I hope. Is there a way to keep the objects created in a script persistent until the application closes? I can see that as soon as the script ends, the objects are destroyed. What I want to do is have Angelscript handle my GUI. As you've seen with my other posts, the script handles the creation of the objects. My intention is to have the GUI actions described in the same script. So as of now, the script runs, ends, and everything is cleaned up. Which is great if that is what you want, but I don't :). Any suggestions? Is it nothing more than changing the way the C++ object is registered?

Few more problems

20 January 2009 - 08:17 AM

Hello. It's me again :). Now that I've cleared up the earlier problems thanks to WitchLord's wonderful help, I have a few more problems. Two of them may be linked, but I'm not sure. One of the class methods I registered causes things to crash right away. I'm not sure why. It's a function that works when used by the class itself external to scripting. It is passed a std::string. Another function will execute, but the string that is supposed to be passed to it from the script doesn't come through. It gets displayed as a square block. After this function is called, I get an immediate crash. If I take this call out and the script is basically empty, no crash occurs. It just calls MessageBoxA This may be something I'm doing. I'm not sure.

Class registration problem

18 January 2009 - 04:15 PM

I have registered a C++ class successfully (according to return codes), but when I try to use it in a script, I get an "Expected Identifier" error.
engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);

	int r = engine->SetMessageCallback(asMETHOD(CLoad, GetScriptError), this, asCALL_THISCALL); assert( r >= 0 );


	r = engine->RegisterObjectType("CEngine", sizeof(CEngine), asOBJ_VALUE | asOBJ_APP_CLASS_CDA); assert( r >= 0 );

	r = engine->RegisterObjectBehaviour("CEngine", asBEHAVE_CONSTRUCT, "void f()", asMETHOD(CLoad, Constructor), asCALL_THISCALL); assert(r >= 0);
	r = engine->RegisterObjectBehaviour("CEngine", asBEHAVE_DESTRUCT, "void f()", asMETHOD(CLoad, Destructor), asCALL_THISCALL); assert(r >= 0);

	r = engine->RegisterObjectMethod("CEngine", "void ShowMessage(string &in)", asMETHOD(CEngine, ShowMessage), asCALL_THISCALL); assert( r >= 0 );

	r = engine->RegisterObjectMethod("CEngine", "void Find(string &in)", asMETHOD(CEngine, FindGame), asCALL_THISCALL); assert( r >= 0 );

	r = engine->RegisterObjectMethod("CEngine", "void LoadExtension(string &in)", asMETHOD(CEngine, Extension), asCALL_THISCALL); assert( r >= 0 );

void main()

CEngine blah;


Am I doing something wrong? Also, is it a bad idea to have the registered construction and destruction functions in another class? I'm trying not to put Angelscript code inside the C++ class. Finally, if I leave the body of the void main function empty, asserts are raised. Why is that?

Extending an Angelscript implementation

18 January 2009 - 12:14 PM

Hello, Let's say I have a program that I have implemented Angelscript in. I have bound to a C++ class in my application. Let's say another user wants to extend that C++ class by loading a plugin. This plugin gets passed the Angelscript scriptengine object. If that user were to use that object, could they bind their own C++ class methods into the existing class in the original program or is that not going to work as expected? What are my options?

Fox News calls Virginia for Obama

04 November 2008 - 03:36 PM

That puts Obama at 220, so when he wins California, he is over his required 270. :)