Simple scripting problem?

Posted By: Recreator

Simple scripting problem? - 12/15/10 10:07

Why does it give me E1513 (CRASH IN) each frame? The entity moves like it should, but i can't see any empty pointer here...

Code:
action snake()
{
	VECTOR *lookAt;
	while (1)
	{
		
		vec_for_angle(lookAt, my.pan);
		vec_scale(lookAt, 11.1);
		c_move(me, vector(0,0,0), lookAt, GLIDE);
		wait(1);	
	}


}


Posted By: 3dgs_snake

Re: Simple scripting problem? - 12/15/10 10:30

Hi,

I think because the lookAt vector is not initialized thus pointing to an illegal memory : you need to initialize it with malloc or sys_malloc and free it when you don't nees it anymore; or you can use a vector struct instead a vector pointer ;
Code:
action snake()
{
	VECTOR lookAt;
	while (1)
	{
		
		vec_for_angle(&lookAt, my.pan);
		vec_scale(&lookAt, 11.1);
		c_move(me, vector(0,0,0), &lookAt, GLIDE);
		wait(1);	
	}


}


© 2023 lite-C Forums