Code:
#include <acknex.h>
#include <default.c>


VECTOR* Point1 = {x=5; y=5; z=5;}
VECTOR* Point2 = {x=2; y=2; z=2;}
VECTOR* vecPoint1_Point2 = {x=0; y=0; z=0;}



function calculateVector(VECTOR* a,VECTOR* b)
{
return(vec_sub(a,b));
}

PANEL* Anzeige=
{
digits (10, 10, 5, *, 1,vecPoint1_Point2.x);
digits (10, 20, 5, *, 1,vecPoint1_Point2.y);
digits (10, 30, 5, *, 1,vecPoint1_Point2.z);

flags = VISIBLE;
}

function main()
{
screen_color.blue=150;
vec_set(vecPoint1_Point2,calculateVector(Point1,Point2));
}



VECTOR* vecPoint1_Point2; creates a vector-pointer, not a vector so it must be
VECTOR* vecPoint1_Point2 = {x=0; y=0; z=0;}

And I think it's not good to define a panel in the main function.



I tried running the script but the results are wrong. If you replace
vec_set(vecPoint1_Point2,calculateVector(Point1,Point2));
with
vec_set(vecPoint1_Point2,vec_sub(Point1,Point2));
it works. Dunno why...

-------------------------
EDIT: TWO was faster

If you replace
VECTOR* vecPoint1_Point2; with
VECTOR* vecPoint1_Point2 = {x=0; y=0; z=0;} his code works fine

Dunno why that works:
vecPoint1_Point2=calculateVector(Point1,Point2);
I think normally you must use vec_set...

Last edited by Lukas; 10/24/07 20:15.