About Store Forum Documentation Contact



Post Reply 
alway return false
Author Message
neo22 Offline
Member

Post: #1
alway return false
Hi,
I'm currently working on a command system.
When the user type comethink beginning by "/" it will be detect as a command, else it's a chat message...
there is a part of my code
Code:
if(t.first() == Char("/"))
the problem is that this condition is always false, i dont understand why.
I start on using EE so be lenient wink.

I'm french, so my english is not as good as i want it to be.
02-03-2011 09:45 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: alway return false
Esenthel has a built-in function for testing chars. Try this:

Code:
if (Equal(t.first(), "/"))
02-03-2011 09:54 PM
Find all posts by this user Quote this message in a reply
runewake2 Offline
Member

Post: #3
RE: alway return false
I know that in Java you compare Strings with double quotes "This is a String" and Chars with single quotes 'C'. If you want to only compare Chars and not strings than try that.

You can NEVER compare strings with a boolean operator. This just compares memory locations and will (at least in your case) always return false since too variables can not have the same location.
02-04-2011 01:35 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: alway return false
if(t.first() == '/')
' is for characters
" is for strings
02-04-2011 06:07 PM
Find all posts by this user Quote this message in a reply
neo22 Offline
Member

Post: #5
RE: alway return false
Ok Thanks,
It perfectly working now.
02-05-2011 12:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply