Author |
Message |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Fri Feb 06, 2004 9:59 pm Post subject: characters |
 |
|
|
|
My problem with the bot...
char a = 'A';
String blah = a;
Why does blah return 41 and not 'A'; and how can I fix this?
Dr Brain suggested doing String blah = String(a); and still didnt work.. any other would help thanks |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Fri Feb 06, 2004 10:19 pm Post subject: |
 |
|
|
|
oh yeah does anyone have access to the
inRadius() code thats in the flag.dll -- like determines a radius circular (tiles) ? |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Fri Feb 06, 2004 10:21 pm Post subject: |
 |
|
|
|
... (contents that was here, is not revelant anymore) |
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Fri Feb 06, 2004 10:37 pm Post subject: |
 |
|
|
|
In radius is simple to make: distance = sqrt( (x1 - x2) ^ 2 + (y1 - y2) ^ 2)
As for the charater: its because type char is stored as a number, like everything else. So to get it to be a string, it needs to be an array, of length 2 (so you can set '\0' at the end). |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Sat Feb 07, 2004 12:03 am Post subject: |
 |
|
|
|
but isnt that convered under one of catid's functions of the string class.. well prob not since it is storing as a string |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Sat Feb 07, 2004 12:11 am Post subject: |
 |
|
|
|
thanks MGB it worked harhar |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Sat Feb 07, 2004 1:13 am Post subject: |
 |
|
|
|
Here is a clip of code incase anyone would ever need to use it:
int x = ((p->tile.x * 20) / 1024) + 65;
int y = ((p->tile.y * 20) / 1024) + 1;
char az[2]={x,'\0'};
String ret = az;
// haha just = az not [2]
//ret becomes the location of the player at a coord like: A10, B20 etc...
Last edited by CypherJF on Sat Feb 07, 2004 6:38 pm, edited 1 time in total |
|
Back to top |
|
 |
Dustpuppy Server Help Squatter

Age:40 Gender: Joined: Jan 23 2003 Posts: 215 Location: England Offline
|
Posted: Sat Feb 07, 2004 3:27 am Post subject: |
 |
|
|
|
Uh...was that code tested?
Am I the only one who things something should have gone badly wrong? |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sat Feb 07, 2004 8:08 am Post subject: |
 |
|
|
|
A10/B20 in only 2 chars? |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sat Feb 07, 2004 4:30 pm Post subject: |
 |
|
|
|
Thats a problem with ?flaginfo in asss too, not enough characters for 10-20 _________________
 |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Sat Feb 07, 2004 5:52 pm Post subject: |
 |
|
|
|
No it works just fine.. cause it takes the character stores into a 2 char array; the actual char # and \0
then append the actual # from int y and wallah you get ret = L#
tested it out worked just fine |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sat Feb 07, 2004 6:29 pm Post subject: |
 |
|
|
|
That should have problems. It's exceeding the char array. It won't give a compile error (like in Java) but shouldn't give you the right data... _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Sat Feb 07, 2004 6:37 pm Post subject: |
 |
|
|
|
oh not the [2] but just az  |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Feb 08, 2004 12:24 pm Post subject: |
 |
|
|
|
Oh, ok, that would work. |
|
Back to top |
|
 |
Dustpuppy Server Help Squatter

Age:40 Gender: Joined: Jan 23 2003 Posts: 215 Location: England Offline
|
Posted: Sun Feb 08, 2004 1:17 pm Post subject: |
 |
|
|
|
Heh that's what I was referring to |
|
Back to top |
|
 |
|