Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


- - - - -

Multiple object arguments problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Zervoxe   Members   -  Reputation: 535

Like
0Likes
Like

Posted 09 February 2014 - 11:07 PM

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, 09 February 2014 - 11:30 PM.


Sponsor:

#2 Zervoxe   Members   -  Reputation: 535

Like
0Likes
Like

Posted 10 February 2014 - 04:05 AM

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



#3 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 10 February 2014 - 09:23 AM

The reserved keywords are the ones listed here: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_reserved_keywords.html

 

However, I'll see if I can make the error message a bit more clear. For example, it could mention that the 'cast' wasn't expected at this position.


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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS