Advertisement

Concurrent script issue.

Started by April 06, 2008 11:21 PM
3 comments, last by BornToCode 16 years, 7 months ago
I am running two scripts. i halted the first script to execute the second one. But when i call execute on the first script again it looks like the stack pointer for that script is not continuing where i halted from. So i am wondering is there anything special i need to do.
How did you halt the script?

Normally you would register a function like this:

void Suspend(){   asGetActiveContext()->Suspend();}


When this function is called from the script the asIScriptContext::Execute() method will return with the code asEXECUTION_SUSPENDED. To resume the execution again it's only necessary to call asIScriptContext::Execute() again, and the script will resume right after the call to Suspend().

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

Advertisement
I never knew about the asGetActiveScriptContext, so what i did is kept an reference handle to the current script that is executing. then i have an function which call suspend on that handle whenever i want to pause the current script that is running. WitchLord, i have an quick question. Is it that as long two scripts have different module name, regardless if the function name you provide are the same, it will run in an different name space correct.

PS: This is an awesome scripting language man.
Keeping a reference to the current context should work as well, though I suppose asGetActiveContext is a bit easier. ;)

Did you manage to resolve the problem with resuming the execution?

Yes, each module is within it's own namespace. If you try to build two scripts with the same module name, the second script will overwrite the first one.

I'm happy you like the library.

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

WitchLord. Yes i fix the problem. I believe i just needed some sleep. Well the problem was because of me. after drinking some red bull last night i decide to tackle the problem and i figure that my script reference handle address was never being changed, that is why the second script was not getting fired. So i fix that.

This topic is closed to new replies.

Advertisement