neo22
Member
|
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 .
I'm french, so my english is not as good as i want it to be.
|
|
02-03-2011 09:45 PM |
|
Driklyn
Member
|
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 |
|
runewake2
Member
|
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 |
|
Esenthel
Administrator
|
RE: alway return false
if(t.first() == '/')
' is for characters
" is for strings
|
|
02-04-2011 06:07 PM |
|
neo22
Member
|
RE: alway return false
Ok Thanks,
It perfectly working now.
|
|
02-05-2011 12:12 PM |
|