Where is error here?!

Posted By: 3run

Where is error here?! - 06/28/10 20:59

Engine says that there is syntax error:
Code:
function vec_randomize(&vec,&range)
{
	vec[0] = random(1) - 0.5;
	vec[1] = random(1) - 0.5;
	vec[2] = random(1) - 0.5;
	vec_normalize(vec,random(range));
}

BUT WHERE IS IT?! mad
Posted By: Rasch

Re: Where is error here?! - 06/28/10 21:00

are you using lite-c ?

if this a vector maybe you should write something like that.

Code:
function vec_randomize(VECTOR vec,var range)
{
	vec.x = random(1) - 0.5;
	vec.y = random(1) - 0.5;
	vec.z = random(1) - 0.5;
	vec_normalize(vec,random(range));
}


Posted By: 3run

Re: Where is error here?! - 06/28/10 21:02

yes, this is from an old c-script project. I want to convert this in to LITE-C.
Posted By: Rasch

Re: Where is error here?! - 06/28/10 21:05

if you still gtet an error maybe it is:

Code:
function vec_randomize(VECTOR* vec,var range)
{
	vec.x = random(1) - 0.5;
	vec.y = random(1) - 0.5;
	vec.z = random(1) - 0.5;
	vec_normalize(vec.x,random(range));
}


Posted By: Superku

Re: Where is error here?! - 06/28/10 21:07

The first argument should be a pointer:

function vec_randomize (VECTOR* vec, var range)
{
vec_set(vec,vector(random(1)-0.5,random(1)-0.5,random(1)-0.5));
vec_normalize(vec,random(range));
}

EDIT: Too late...
© 2023 lite-C Forums