String size
#1

hi all...

i have a question
do the '\t' is counted as one cell or two cells? and is the other too?

i want to make a dialog and i wont to waste my memory,,,

Код:
/about\t\t\t>> Show the credits of this server\n\
/admins\t\t\t>> Show the list of online admins\n\
/afk\t\t\t>> Go AFK\n\
/back\t\t\t>> Back from AFK\n\
/color\t\t\t>> Change your color\n\
/count\t\t\t>> Start countdown\n\
/fightstyle\t\t>> Change your fightstyle\n\
/godmode\t\t>> Turn your godmode on/off\n\
/help\t\t\t>> Open the help center\n\
/jetpack\t\t>> Use a jetpack\n
/kill\t\t\t>> Suicide\n\
/pc\t\t\t>> Get a parachute\n\
/pickuphunt\t\t>> Show the info of pickuphunt\n\
/pm\t\t\t>> Send a private message\n\
/radio\t\t\t>> Listen to a radio\n\
/report\t\t\t>> Report a cheater\n\
/rules\t\t\t>> Show the rules\n\
/savespawnpos\t\t>> Show the position\n\
/skin\t\t\t>> Change your skin\n\
/skydive\t\t>> Skydive!\n\
/spawn\t\t\t>> Respawn\n
/stats\t\t\t>> Show player statistic\n\
/stopradio\t>> Stop listening radio\n\
/t\t\t\t>> open teleport menu\n\
/usesavedspawnpos\t>> Use the saved position\n\
/tgoto\t\t\t>> Turn your goto on/off\n\
/v\t\t\t>> Spawn a vehicle\n\
/vips\t\t\t>> Show the list of online VIP\n\
/weapon\t\t\t>> Get a weapon\n
Reply
#2

'\t' stands for 'Tabulate', or TAB, 1 '\t' is just like when you tabbing on your pawno.
Reply
#3

Quote:
Originally Posted by RenovanZ
Посмотреть сообщение
'\t' stands for 'Tabulate', or TAB, 1 '\t' is just like when you tabbing on your pawno.
that's why i asked it here -_-
i'm in doubt is it counted as one cell or two, becouse it's tabulate. And the other like \n (new line) is it counted one cells too?
Reply
#4

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
that's why i asked it here -_-
i'm in doubt is it counted as one cell or two, becouse it's tabulate. And the other like \n (new line) is it counted one cells too?
One cells I think.
Reply
#5

Only one cell. For example, if you do something like:
PHP код:
new str[4] = "ab\t"
You don't need to create array bigger than 4 cells. (Don't forget about '\0' symbol)
Reply
#6

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
that's why i asked it here -_-
i'm in doubt is it counted as one cell or two, becouse it's tabulate. And the other like \n (new line) is it counted one cells too?
A tab char is one byte, so no matter what Pawn's cell size, it needs to be able to output the tabular byte.

However, the newline character is actually a special case. When writing \n (LF - Line Feed) to a text file, it could be converted to \r\n (CRLF- Carriage Return, Line Feed) on Windows, because that is the actual character needed to start a new line. So in that case, \n would be compiled down to two bytes - though, it's not really something for you to worry about as it doesn't actually happen until output to the actual file.

I'm actually taking this knowledge from C/C++, but Pawn should follow a similar method in order to be a portable solution across multiple operating systems.


Now, what do you mean when you say "and i want to waste my memory"? I believe you could do that quicker by making your function call itself indefinitely
Reply
#7

and hell yeah...
i got these error meanwhile these line is commented
Код:
D:\AiRaLoKa\SA-MP Server Project\MP Server\New Indo Stunting\gamemodes\NewIndoStunting.pwn(18610) : error 075: input line too long (after substitutions)
D:\AiRaLoKa\SA-MP Server Project\MP Server\New Indo Stunting\gamemodes\NewIndoStunting.pwn(18625) : error 075: input line too long (after substitutions)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
line 18562 - 18626

pawn Код:
/*
/about              >> Show the credits of this server\n\
/admins             >> Show the list of online admins\n\
/afk                >> Go AFK\n\
/back               >> Back from AFK\n\
/color              >> Change your color\n\
/count              >> Start countdown\n\
/fightstyle         >> Change your fightstyle\n\
/godmode            >> Turn your godmode on/off\n\
/help               >> Open the help center\n\
/jetpack            >> Use a jetpack\n
/kill               >> Suicide\n\
/pc                 >> Get a parachute\n\
/pickuphunt         >> Show the info of pickuphunt\n\
/pm                 >> Send a private message\n\
/radio              >> Listen to a radio\n\
/report             >> Report a cheater\n\
/rules              >> Show the rules\n\
/savespawnpos       >> Show the position\n\
/skin               >> Change your skin\n\
/skydive            >> Skydive!\n\
/spawn              >> Respawn\n
/stats              >> Show player statistic\n\
/stopradio          >> Stop listening radio\n\
/t                  >> open teleport menu\n\
/usesavedspawnpos   >> Use the saved position\n\
/tgoto              >> Turn your goto on/off\n\
/v                  >> Spawn a vehicle\n\
/vips               >> Show the list of online VIP\n\
/weapon             >> Get a weapon\n


=========================================*/
/*



/about\t\t\t\t>> Show the credits of this server\n\
/admins\t\t\t\t>> Show the list of online admins\n\
/afk\t\t\t\t>> Go AFK\n\
/back\t\t\t\t>> Back from AFK\n\
/color\t\t\t\t>> Change your color\n\
/count\t\t\t\t>> Start countdown\n\
/fightstyle\t\t>> Change your fightstyle\n\
/godmode\t\t\t>> Turn your godmode on/off\n\
/help\t\t\t\t>> Open the help center\n\
/jetpack\t\t\t>> Use a jetpack\n\
/kill\t\t\t\t>> Suicide\n\
/pc\t\t\t\t>> Get a parachute\n\
/pickuphunt\t\t>> Show the info of pickuphunt\n\
/pm\t\t\t\t>> Send a private message\n\
/radio\t\t\t\t>> Listen to a radio\n\
/report\t\t\t\t>> Report a cheater\n\
/rules\t\t\t\t>> Show the rules\n\
/savespawnpos\t\t>> Show the position\n\
/skin\t\t\t\t>> Change your skin\n\
/skydive\t\t\t>> Skydive!\n\
/spawn\t\t\t\t>> Respawn\n\
/stats\t\t\t\t>> Show player statistic\n\
/stopradio\t\t>> Stop listening radio\n\
/t\t\t\t\t\t>> open teleport menu\n\
/usesavedspawnpos\t>> Use the saved position\n\
/tgoto\t\t\t\t>> Turn your goto on/off\n\
/v\t\t\t\t\t>> Spawn a vehicle\n\
/vips\t\t\t\t>> Show the list of online VIP\n\
/weapon\t\t\t\t>> Get a weapon\n*/
Quote:
Originally Posted by Deji
Посмотреть сообщение
Now, what do you mean when you say "and i want to waste my memory"? I believe you could do that quicker by making your function call itself indefinitely
sorry for my typo edited
Reply
#8

Use '\' to seperate your string line.
Reply
#9

Quote:
Originally Posted by RenovanZ
Посмотреть сообщение
Use '\' to seperate your string line.
event it's commented?

EDIT:

i fixed it...

i removed some '\' one line before that line
become
pawn Код:
/*
/about              >> Show the credits of this server\n\
/admins             >> Show the list of online admins\n\
/afk                >> Go AFK\n\
/back               >> Back from AFK\n\
/color              >> Change your color\n\
/count              >> Start countdown\n\
/fightstyle         >> Change your fightstyle\n\
/godmode            >> Turn your godmode on/off\n\
/help               >> Open the help center\n\
/jetpack            >> Use a jetpack\n
/kill               >> Suicide\n\
/pc                 >> Get a parachute\n\
/pickuphunt         >> Show the info of pickuphunt\n\
/pm                 >> Send a private message\n\
/radio              >> Listen to a radio\n\
/report             >> Report a cheater\n\
/rules              >> Show the rules\n\
/savespawnpos       >> Show the position\n\
/skin               >> Change your skin\n\
/skydive            >> Skydive!\n\
/spawn              >> Respawn\n\
/stats              >> Show player statistic\n\
/stopradio          >> Stop listening radio\n\
/t                  >> open teleport menu\n
/usesavedspawnpos   >> Use the saved position\n\
/tgoto              >> Turn your goto on/off\n\
/v                  >> Spawn a vehicle\n\
/vips               >> Show the list of online VIP\n\
/weapon             >> Get a weapon\n


=========================================*/
/*



/about\t\t\t\t>> Show the credits of this server\n\
/admins\t\t\t\t>> Show the list of online admins\n\
/afk\t\t\t\t>> Go AFK\n\
/back\t\t\t\t>> Back from AFK\n\
/color\t\t\t\t>> Change your color\n\
/count\t\t\t\t>> Start countdown\n\
/fightstyle\t\t>> Change your fightstyle\n\
/godmode\t\t\t>> Turn your godmode on/off\n\
/help\t\t\t\t>> Open the help center\n\
/jetpack\t\t\t>> Use a jetpack\n\
/kill\t\t\t\t>> Suicide\n\
/pc\t\t\t\t>> Get a parachute\n
/pickuphunt\t\t>> Show the info of pickuphunt\n\
/pm\t\t\t\t>> Send a private message\n\
/radio\t\t\t\t>> Listen to a radio\n\
/report\t\t\t\t>> Report a cheater\n\
/rules\t\t\t\t>> Show the rules\n\
/savespawnpos\t\t>> Show the position\n\
/skin\t\t\t\t>> Change your skin\n\
/skydive\t\t\t>> Skydive!\n\
/spawn\t\t\t\t>> Respawn\n\
/stats\t\t\t\t>> Show player statistic\n\
/stopradio\t\t>> Stop listening radio\n\
/t\t\t\t\t\t>> open teleport menu\n
/usesavedspawnpos\t>> Use the saved position\n\
/tgoto\t\t\t\t>> Turn your goto on/off\n\
/v\t\t\t\t\t>> Spawn a vehicle\n\
/vips\t\t\t\t>> Show the list of online VIP\n\
/weapon\t\t\t\t>> Get a weapon\n*/
Reply
#10

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
event it's commented?

EDIT:

i fixed it...

i removed some '\' one line before that line
POST-EDIT: Yeah, I was just going to mention posting the line before it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)