Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / if statement problem

Author
Message
Master Man Of Justice
16
Years of Service
User Offline
Joined: 13th Feb 2008
Location: Between Insanity and Intelligence
Posted: 2nd Dec 2009 22:36 Edited at: 2nd Dec 2009 22:56
bah i thought it would work but apparently not,
how would i go about re-writing this.


[EDIT]
Okay i got it to not give me an error by changing it to this


but it is'nt checking all of them at the same time im guessing?
Because it isnt showing up on the screen "Press F to Get on sled".
it might be my Y-Coordinate check. Let me take that out and ill edit back
[Edit]
nope... taking the y-coordinate out makes it say "Press F to Get on sled" all the time.
If your wondering heres my whole code. ( its sloppy and it has some unused variable declarations in it.)

and my sled is in the attatchment.
[Edit]
Is it the random Matrix height causing it?

Attachments

Login to view attachments
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 2nd Dec 2009 23:06 Edited at: 2nd Dec 2009 23:10
this line is wrong, its got 2 conditions in each section, but you should only have one

Like This

Couldn't run the code as missing files.

Or are you trying to do something like this?



Everyone Be Cool, You, Be Cool.
Master Man Of Justice
16
Years of Service
User Offline
Joined: 13th Feb 2008
Location: Between Insanity and Intelligence
Posted: 2nd Dec 2009 23:13
Like in the third one.
(I fixed the error problem but read my edit for my new problem )
media is attatched in first post.

empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 4th Dec 2009 18:48 Edited at: 4th Dec 2009 19:08
re-read MSon's code. It's different from yours .

Ok let's analyse your code:

you have two comparison operators. Those both result in boolean values, either True (1) or False (0).

So let's assume x# = 40.0. The first calculation is
30 < 40.0. The result is 1 (True)
Therefore the second calculation is
1 < 50 which also results in 1
Now let's assume x# = 1.0. The first calculation is
30 < 1.0. That results in 0 (False)
the second calculation is
0 < 50 and that is... true.
So no matter what value x# actually holds, the result will always be True.

What we need here is the boolean operator "AND"

If the first calculation (30 < x#) is True AND the second is also true (x# < 50) THEN do the stuff.

Also, you need to declare x# and z# as GLOBAL variables in order to use them within functions.
Master Man Of Justice
16
Years of Service
User Offline
Joined: 13th Feb 2008
Location: Between Insanity and Intelligence
Posted: 6th Dec 2009 21:51
Oh,,, i get it, thank you very much Mson and Empty

Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 7th Dec 2009 19:36
it would be quite cool if inequalities worked though

Login to post a reply

Server time is: 2024-11-16 09:23:52
Your offset time is: 2024-11-16 09:23:52