Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (3run, AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip), 605 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
variables and operators #277121
07/07/09 21:12
07/07/09 21:12
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
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...


Last edited by BastovBros; 07/07/09 21:12.

a generator of dull questions smile
Re: variables and operators [Re: BastovBros] #277146
07/07/09 23:35
07/07/09 23:35
Joined: Aug 2005
Posts: 512
Bayern
Schmerzmittel Offline
User
Schmerzmittel  Offline
User

Joined: Aug 2005
Posts: 512
Bayern
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.

Last edited by Schmerzmittel; 07/07/09 23:36.

A7 Com V7.80
Re: variables and operators [Re: Schmerzmittel] #277164
07/08/09 06:01
07/08/09 06:01
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
Thanks for your answer,
then I'm gonna use the if-else branching smile


a generator of dull questions smile
Re: variables and operators [Re: BastovBros] #277199
07/08/09 09:33
07/08/09 09:33
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
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

Last edited by BastovBros; 07/08/09 10:30.

a generator of dull questions smile
Re: variables and operators [Re: BastovBros] #277209
07/08/09 10:20
07/08/09 10:20
Joined: Aug 2005
Posts: 512
Bayern
Schmerzmittel Offline
User
Schmerzmittel  Offline
User

Joined: Aug 2005
Posts: 512
Bayern
Im not sure, but look in the manual after vec_set, vec_add, vec_to_angle...

There are all vec-functions explained.


A7 Com V7.80
Re: variables and operators [Re: Schmerzmittel] #277212
07/08/09 10:26
07/08/09 10:26
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
I looked, but haven't found anything useful... Now gonna look and search more thoroughly...


a generator of dull questions smile

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1