Jump to content

  • Log In with Google      Sign In   
  • Create Account


Zervoxe

Member Since 28 Aug 2009
Offline Last Active Today, 08:31 AM
-----

Topics I've Started

Angelscript stdstring

09 February 2014 - 11:32 PM

Angelscript in the latest revisions seems to have snuck in a memory leak into stdstring implementation. Atleast Esenthel Engine's memory leak detector seems to find that somewhere inside it is when using string inside angelscript.


Multiple object arguments problem

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.


Rawinput x64 bit problem

26 August 2013 - 06:17 AM

My problem is when I move the mouse in x64 it only moves to right, it ignores up,left and down, it also does it extremely slowly(it only registers a quarter of the mouse delta move) compared to Win32. I expect this is a result of long being 64bit in Win64, and how would I deal with this change?

 

 

WM_INPUT in main.cpp

UInt nSize = 40;
BYTE m_Buffer[40];
GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, (LPVOID)m_Buffer, &nSize, sizeof(RAWINPUTHEADER));
//ASSERT( nSize <= BUFFER_SIZE );
RAWINPUT* pRaw = (RAWINPUT*) m_Buffer;

// Read keyboard and mouse data
if( pRaw->header.dwType == RIM_TYPEKEYBOARD ){Kb.GatherRawInput(&pRaw->data.keyboard );}
if( pRaw->header.dwType == RIM_TYPEMOUSE ){Ms.GatherRawInput( &pRaw->data.mouse);}

Inside MsGatherRawInput

delta is a int x,y structure.

delta.set((int)pRM->lLastX,(int)pRM->lLastY);

void *ptr problem

26 July 2013 - 09:59 AM

So I hit another problem which I couldn't find in the documentation.

I was wondering how would I expose something like

 

void Object::init(void* agent)

from C++ to Angelscript?


[Solved]Unable to pass global object function to globalfunction

28 June 2013 - 03:05 PM

I am new to AngelScript and in need of help. ;)

 

as per the suggestion here.

http://www.angelcode.com/angelscript/sdk/docs/manual/doc_register_func.html







r = engine->RegisterGlobalFunction("void AppName(const Str &in)", asMETHODPR(Application, name,Str,Application), asCALL_THISCALL_ASGLOBAL, &App);

I get error









C2061: syntax error : identifier 'Str'

if I do (Str)

 

'static_cast' : cannot convert from 'overloaded-function' to 'Application (__thiscall Application::* )(Str)'
1> None of the functions with this name in scope match the target type











r = engine->RegisterGlobalFunction("void AppName(const Str &in)", asMETHOD(Application, name), asCALL_THISCALL_ASGLOBAL, &App);
d:\prod\main.cpp(66): error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'void (__thiscall Application::* )(void)'
1> None of the functions with this name in scope match the target type


struct Application{ // Application Settings

Application& name (const Str &name); // set application name
const Str& name ( ) {return _name ;} // get application name


}extern App


PARTNERS