variables and operators

Posted By: BastovBros

variables and operators - 07/07/09 21:12

Hello, I am a bit confused with using variables and operators... I don't see the particular difference between them and don't understand why some expressions work with operators and do not work with variables.
Take a look at this code:
Quote:

...
var maxdistance = 10;
var countdistance ; // or var countdistance = 5;

action move()
{...
maxdistance > countdistance;
...}

And it constantly shows an error when I try to run the game. Variables can't be compared? Only maxdistance = countdistance works....
Sorry for this silly newbie question smile Any explanation appreciated...

Posted By: Schmerzmittel

Re: variables and operators - 07/07/09 23:35

The usage of operators depends on what you try to get.
You wrote maxdistance > countdistance;
That cant work because you say the A7 engine that maxdistance is bigger then countdistance.

If you like to use it in an action and you want to say the engine: Hey engine! If ... bigger than ... then do this!

Sorry its late and my english is bad on this time.

Hope you understand what i mean.

You can use it like:
maxdistance = countdistance //maxdistance has now the same value as countdistance
Or like this:
if(maxdistance > countdistance)
{
then do what you want
...some code
}

Hope this helps. For more help look at the lite-c tutorial. Chapter 2 or so about variable.

Greetings
Schmerzmittel


EDIT:
If you write:
maxdistance = 5;
Then you say the engine that maxdistance is 5.
Posted By: BastovBros

Re: variables and operators - 07/08/09 06:01

Thanks for your answer,
then I'm gonna use the if-else branching smile
Posted By: BastovBros

Re: variables and operators - 07/08/09 09:33

another newbie question...
here's the code:
Quote:
VECTOR temp;
VECTOR temp2;
VECTOR temp3;
var length;
var length2;

action bla-bla()
{
vec_set(temp, vector(0,0,0));
vec_set(temp, vector(10,0,0));
vec_set(temp, vector(0,-10,0));
lendth = vec_dist(temp, temp2);
length2 = vec_dist(temp, temp3);
}
//angle between lenth and lenth2??

How can I calculate the angle between these two distances (length and length2)and give the name to this angle, so that I can use this andgle for changing other parameters??? And is it possible at all?
Thank you for your patience smile
Posted By: Schmerzmittel

Re: variables and operators - 07/08/09 10:20

Im not sure, but look in the manual after vec_set, vec_add, vec_to_angle...

There are all vec-functions explained.
Posted By: BastovBros

Re: variables and operators - 07/08/09 10:26

I looked, but haven't found anything useful... Now gonna look and search more thoroughly...
© 2023 lite-C Forums