Raised This Month: $ Target: $400
 0% 

Pawn Strings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-28-2008 , 14:11   Pawn Strings
Reply With Quote #1

Hey, I just want to clarifiy:

The reason we do things like:

new name[32]
get_user_name(id, name, 31)

is becauset here is a delimiter in pawn right?

So my name would be JohnRocksAndKilledHimThenAteIt!
So the name is 31 chars long. Now at then end is the delimiter '\0' in pawn? I know C++ has this.
Styles is offline
Send a message via AIM to Styles
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 05-28-2008 , 14:33   Re: Pawn Strings
Reply With Quote #2

Delimiter is 0 not \0.
I don't think there is a 32:nd cell.

Delimiter or NULL is not neccessary unless you want to cut the string off at a specific cell.
[ --<-@ ] Black Rose is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-28-2008 , 14:37   Re: Pawn Strings
Reply With Quote #3

It can also be '^0'
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 05-28-2008 , 17:16   Re: Pawn Strings
Reply With Quote #4

Show me.
[ --<-@ ] Black Rose is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-29-2008 , 02:27   Re: Pawn Strings
Reply With Quote #5

amxx just convert ^0 to 0 when formating.

You can replace ^ by another character puting #pragma ctrlchar '\' for example.
So ^0, ^n ... becomes \0 , \n
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-29-2008 , 20:35   Re: Pawn Strings
Reply With Quote #6

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
I don't think there is a 32:nd cell.
Why would you say such a thing?

Code:
new myArray[32];
myArray[0] 1st
myArray[1] 2nd
myArray[2] 3rd
myArray[3] 4th
myArray[4] 5th
myArray[5] 6th
myArray[6] 7th
myArray[7] 8th
myArray[8] 9th
myArray[9] 10th
myArray[10] 11th
myArray[11] 12th
myArray[12] 13th
myArray[13] 14th
myArray[14] 15th
myArray[15] 16th
myArray[16] 17th
myArray[17] 18th
myArray[18] 19th
myArray[19] 20th
myArray[20] 21st
myArray[21] 22nd
myArray[22] 23rd
myArray[23] 24th
myArray[24] 25th
myArray[25] 26th
myArray[26] 27th
myArray[27] 28th
myArray[28] 29th
myArray[30] 30th
myArray[30] 31st
myArray[31] 32nd

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
Delimiter is 0 not \0.
Delimiter or NULL is not neccessary unless you want to cut the string off at a specific cell.
It's called a string terminator, not a delimiter. According to the Pawn language specification (40, 103-4, 142), the string terminator is \0, but since AMXX uses ^ as the default escape character, we use ^0. String terminators are not optional.

Don't let facts get in the way of your corrections though. ;)

^0 is not equal to 0.

Last edited by Lee; 05-29-2008 at 20:40.
Lee is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-29-2008 , 20:53   Re: Pawn Strings
Reply With Quote #7

Quote:
Originally Posted by Lee View Post
...
^0 is not equal to 0.
If you set a cell to 0 it has the same effect as formatting it with a string terminator.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-30-2008 , 02:46   Re: Pawn Strings
Reply With Quote #8

Thanks sorry, yeah not a delimiter, a terminator... wow I was stupid, so in pawn its ^0 not \0 but it does exist?
Styles is offline
Send a message via AIM to Styles
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 05-30-2008 , 10:52   Re: Pawn Strings
Reply With Quote #9

Quote:
Originally Posted by Lee View Post
Why would you say such a thing?

Code:
new myArray[32];
myArray[0] 1st
// lots of gayness //
myArray[31] 32nd

It's called a string terminator, not a delimiter. According to the Pawn language specification (40, 103-4, 142), the string terminator is \0, but since AMXX uses ^ as the default escape character, we use ^0. String terminators are not optional.

Don't let facts get in the way of your corrections though. ;)

^0 is not equal to 0.
Good job, failure. Pawn isn't only used for AMXX and it's probably customizable.
I would've given you +K for a nice try but I can't.

Quote:
Originally Posted by styles View Post
Thanks sorry, yeah not a delimiter, a terminator... wow I was stupid, so in pawn its ^0 not \0 but it does exist?
You can change the escape char and I guess there's no differance between ^0 and 0 cept 0 is easier to write and looks way better.

Last edited by [ --<-@ ] Black Rose; 05-30-2008 at 10:55.
[ --<-@ ] Black Rose is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-30-2008 , 13:29   Re: Pawn Strings
Reply With Quote #10

kk thats fun to know! +K all
Styles is offline
Send a message via AIM to Styles
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 -4. The time now is 15:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode