Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-11-2006, 03:53 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Another Operator Precedence Issue!

this.mode != "jumping"
is not the same as !this.mode == "jumping"
apparently.
Reply With Quote
  #2  
Old 01-11-2006, 04:40 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by jake13jake
this.mode != "jumping"
is not the same as !this.mode == "jumping"
apparently.
and it shouldn't be. You are saying the not of this.mode (which is a boolean) equals jumping (which is a string) So it -should- always return false, no matter what. To fix this just do: !(this.mode == "jumping")
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #3  
Old 01-11-2006, 06:28 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by jake13jake
this.mode != "jumping"
is not the same as !this.mode == "jumping"
apparently.
Why would it be?

Unless you're surrounding it with brackets, it's treating !this.mode == "jumping" effectively as Not this.mode equal to "jumping", which probably will be even more senseless as "jumping" is not a boolean.
__________________
Skyld
Reply With Quote
  #4  
Old 01-11-2006, 06:35 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Skyld
Why would it be?

Unless you're surrounding it with brackets, it's treating !this.mode == "jumping" effectively as Not this.mode equal to "jumping", which probably will be even more senseless as "jumping" is not a boolean.
That's exactly what I said, Mister Skyld.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 01-11-2006, 09:38 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
So it tests as a boolean when comparing to a string value and as a floating point when comparing to a floating point? I'm so confused.
Reply With Quote
  #6  
Old 01-11-2006, 09:44 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by jake13jake
So it tests as a boolean when comparing to a string value and as a floating point when comparing to a floating point? I'm so confused.
... what? '!' is a boolean operator, I think !this.stringvalue tests if the string is set or not, ie:

PHP Code:
temp.stringval "Wee";
if(
temp.stringval) echo("This should fire.");

temp.stringval ""// or unset("temp.stringval");
if(!temp.stringval) echo("This should also fire."); 
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #7  
Old 01-11-2006, 11:54 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by jake13jake
So it tests as a boolean when comparing to a string value and as a floating point when comparing to a floating point? I'm so confused.
You're only negating the left side of the comparison (this.mode) in your second case, which (assuming this.mode is a string) is negating a string.

Do you understand how negating a string could cause a problem?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:54 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.