Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Test Vector
Test Vector
2004-01-23, 12:29 PM #1
Hi!
How do I test if a vector is Equel to something. I have tried if(GetSectorThrust(GetThingSector(player))!='0 0 0') but parsec says: Type Mismatch. int expected but found vector.

Help!

/Edward
Edward's Cognative Hazards
2004-01-23, 1:31 PM #2
That's wierd. I changed 'GetThingSector(player)' to '5' so it was 'if(GetSectorThrust(5) != '0 0 0')', and I still got a type mismatch. You've got me relly confused. [http://forums.massassi.net/html/confused.gif]

[edit]
I found a way to get around it, I think. Try this code instead, adding the variable 'vector vec local' to the symbols section. It went through Parsec w/o any errors.

Code:
	vec = GetSectorThrust( GetThingSector( player ) );
	if( vectorx(vec) != 0 && vectory(vec) != 0 && vectorz(vec) != 0) 


Does anyone know if you can compare vectors via an if statement? Could that be the problem?

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team

[This message has been edited by Darth Slaw (edited January 23, 2004).]
May the mass times acceleration be with you.
2004-01-23, 1:40 PM #3
Try comparing it to "vectorset(0, 0, 0);" instead of '0 0 0'.

If that doesn't work I know for a fact you can separately compare the vectorx, vectory, and vectorz.

------------------
Duel Zero : Released the beta. Probably the end of it. Not to worry though, I'm working on Randsaber, which is a lot better.

[This message has been edited by Checksum (edited January 23, 2004).]
2004-01-23, 1:41 PM #4
It could be, but you could try if(vec == '0 0 0') to make sure it's not a problem with Parsec. You could also try ignoring Parsec and seeing if it works anyway.

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2004-01-23, 3:43 PM #5
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Emon:
...You could also try ignoring Parsec and seeing if it works anyway.</font>



Yeah, Parsec isnt perfect. If in doubt, try it anyway. Worst case scenerio; your system will freeze up.. So be sure to have everything saved before you try it... [http://forums.massassi.net/html/wink.gif]

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-01-23, 4:38 PM #6
Well, I tried that and I still got the error, Emon. [http://forums.massassi.net/html/frown.gif]

Datamaster doesn't say anything against comparing vectors. It says that "== checks two values for equality". Maybe Parsec is wrong like you guys said? Or maybe vectors just can't be compared in that way?

I'd try what Checksum suggested. If all else fails, try it ingame anyway (as was stated).

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-01-23, 10:48 PM #7
you tried seting that '0 0 0' in symbols ?
like

vector vec=(0/0/0)

if(vec==.. )

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2004-01-23, 11:40 PM #8
Symbols vector vec=(0/0/0) local
was tried. It didn't work. Parsec: vector may not have initial value.

OK, VectorSet(0,0,0) was a mismatch. Didn't work ingame...

And testing X Y Z seperatly didn't work. But parsec says nothing about it.

istherethrust=GetSectorThrust(GetThingSector(player));
if((VectorX(istherethrust)!=0) && (VectorY(istherethrust)!=0) && (VectorZ(istherethrust)!=0))

(0/0/0) = Type mismatch. BUT!
Whether there is thrust or not, actions under if are activated.

/Edward
Edward's Cognative Hazards
2004-01-24, 1:04 AM #9
I dont think its possible to compare the whole vectors to each other. I think you need to break it into x,y,z and compare those values as integers.

------------------
- Wisdom is 99% experience, 1% knowledge. -
- Wisdom is 99% experience, 1% knowledge. -
2004-01-24, 9:50 AM #10
If comparing x, y, and z separately didn't work then nothing will.

------------------
Duel Zero : Released the beta. Probably the end of it. Not to worry though, I'm working on Randsaber, which is a lot better.
2004-01-24, 10:04 AM #11
Testing each component individually works. It has to. You must be doing something wrong.

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.

↑ Up to the top!