Jump to content
  • Advertisement
Sign in to follow this  
Zervoxe

Multiple object arguments problem

This topic is 2075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently getting some issues with compiling my script

AngelScript:

int SpellFire(BaseEntity& spell, BaseEntity& cast, BaseEntity& trg){
return 0;
}
C++ call and BaseEntity registry
 
Register
void RegisterBaseEntityAngel(asIScriptEngine *engine){
// Registering the class method
int r = engine->RegisterObjectType("BaseEntity", sizeof(BaseEntity), asOBJ_REF); DYNAMIC_ASSERT(r >= 0, "Error in return result");
r = engine->RegisterObjectBehaviour("BaseEntity", asBEHAVE_ADDREF, "void f()", asMETHOD(BaseEntity, AddRef), asCALL_THISCALL); DYNAMIC_ASSERT(r >= 0, "Error in return result");
r = engine->RegisterObjectBehaviour("BaseEntity", asBEHAVE_RELEASE, "void f()", asMETHOD(BaseEntity, Release), asCALL_THISCALL); DYNAMIC_ASSERT(r >= 0, "Error in return result");
Init
ctx = scriptMgr.GetEngine()->CreateContext();
asIScriptModule *mod = scriptMgr.GetEngine()->GetModule("SpellFuncs");
Function = mod->GetFunctionByDecl(Str8(Stat("Script")->string));
update
ctx->Prepare(Function); 
ctx->SetArgObject(0, &T);// Set the function arguments 
ctx->SetArgObject(1, cast);// Set the function arguments 
ctx->SetArgObject(2, trg);// Set the function arguments 
scriptMgr.ExecuteCall(ctx); 
int dmg = ctx->GetReturnDWord(); 
ctx->Unprepare();

Log complaints

Data/Script/Spells/Fire.as (1, 46) : ERROR:  : Expected ')' or ','Please correct the errors in the script and try again.  (0, 0) : ERROR:  : Failed in call to function 'Prepare' with 'null' (Code: -6)  (0, 0) : ERROR:  : Failed in call to function 'Execute' (Code: -4)

Anyone care to explain what I am doing wrong?

I've tried removing and changing @ to & and without sign

 

It works if I am using only one BaseEntity.

Edited by Zervoxe

Share this post


Link to post
Share on other sites
Advertisement

I found that I could not use cast as a argument name, I thought cast would be with Capital c rather than non capital.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!