![]() Jun 27 2008, 6:11 pm
In response to Naokohiro
|
|
No, your else statement makes no different. The && operator is short-circuting. Breaking the code up, as you have, makes it work exactly</t> the same as it would together.
|
That is quite incorrect, but whatever. I doubt you even looked at the code I posted, since I'm pretty sure you're not an idiot.
I still go with my way: mob/var/tmp/locked=0//make locked var EDIT: Added comments to help a little. |
That code is different, in that you're missing a certain if statement.
The code from [link]: mob The code from [link]: mob/var/tmp/locked=0 |
I didn't post the same code twice, why the heck would I? XD The second one is my original way of doing it.
|
Naokohiro wrote:
That is quite incorrect, but whatever [...] Except, it isn't. Follow the code execution in your mind/eyes and see he's right. |
But it's like this, if you are swimming, then check the second if, if not, don't even bother with the second if, disregard it, and go to the else statement. XD
|
Kaioken wrote:
Follow the code execution in your mind/eyes and see he's right. Ok, add "looking up the && operator" to that. Even though you should have done it anyway, and Pop already mentioned it works in a short-circuiting method. |
So, let me get this straight, you guys think these two things are the same thing?:
//Thing one: I simply thought this: if(var1) EDIT: //in other words, |
Again, look up the && operator. Both approaches are the same, because if the first value (condition) is false, the && operator will return false, therefore the if() will fail, and so the else will run.
|
No, because even if var1 returns true when var2 is false, then it will still go to the else, whereas if it's two ifs, the else part will be skipped. (The desired outcome)
|
Naokohiro wrote:
(The desired outcome) Is it? Seemed to me from your posts you were only doing it so the 2nd condition wouldn't be evaluated needlessly, as in "don't bother with the 2nd if()", by your post. |
Naokohiro wrote:
you've got it backwards. Interesting. But it's like this, if you are swimming, then check the second if, if not, don't even bother with the second if, disregard it, and go to the else statement. XD |
Yeah, I wasn't thinking. I had it backwards then.
Once you told me in pager, I realized what my logic was. Sometimes, my instinctual logic kicks in and doesn't tell me why it' doing something. But, I still figured out why. That instinct is very good for math class. XD |
I tested that whole thing again, and now it's a different bug it seems. Going into the water does indeed set the movement state to 2(SWIMMING), but I don't get the delay or swimgain.. It's as if I'm on the land as usual. <--- This
|
Requested Code:
mob Problems: It shifts over to SWIMMING when I enter water, but it still depends on the WALKING speed (Based on the Speed stat), so I basically speed through the water without delay. |
mob |
Naokohiro wrote:
mob Code: mob Comments: Still not working at all... maybe I have the code wrong or something... but it still acts as though the character is on land when in water (And thus moves without delay). |