Server Help

Bot Questions - characters

CypherJF - 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 icon_smile.gif thanks
CypherJF - 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) ?
CypherJF - Fri Feb 06, 2004 10:21 pm
Post subject:
... (contents that was here, is not revelant anymore)
Mine GO BOOM - 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).
CypherJF - 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
CypherJF - Sat Feb 07, 2004 12:11 am
Post subject:
thanks MGB it worked icon_wink.gif harhar
CypherJF - 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...
Dustpuppy - 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?
Smong - Sat Feb 07, 2004 8:08 am
Post subject:
A10/B20 in only 2 chars?
D1st0rt - Sat Feb 07, 2004 4:30 pm
Post subject:
Thats a problem with ?flaginfo in asss too, not enough characters for 10-20
CypherJF - 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#

icon_smile.gif tested it out worked just fine
Cyan~Fire - Sat Feb 07, 2004 6:29 pm
Post subject:
Code: Show/Hide
String ret = az[2];

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...
CypherJF - Sat Feb 07, 2004 6:37 pm
Post subject:
oh not the [2] but just az icon_smile.gif
Cyan~Fire - Sun Feb 08, 2004 12:24 pm
Post subject:
Oh, ok, that would work.
Dustpuppy - Sun Feb 08, 2004 1:17 pm
Post subject:
Heh that's what I was referring to
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group