Ellipsis operator between strings -
Scottas - 21.07.2011
I found this in Pawn Language Guide ( page 101 ), and it looked useful for me, but when I tried to use it, I get an error:
Код:
error 001: expected token: "-string end-", but found "-identifier-"
Code:
pawn Код:
print ( "first " ... "second" );
So, am I doing something wrong, or its not supported?
Re: Ellipsis operator between strings -
Patrik356b - 21.07.2011
SA-MP's version of pawno is alterd, so it may not be supported.
Same goes for strcopy, void, register - they all seem to have been removed/disabled
Re: Ellipsis operator between strings -
Scottas - 21.07.2011
Thank you for answer. So I'll use '\' for line breaks
Re: Ellipsis operator between strings -
Calgon - 21.07.2011
The ellipses operator is used for signalling a difference between integers. You can use it in switch cases, like so:
pawn Код:
public OnPlayerConnect(playerid) {
switch(GetPlayerScore(playerid)) {
case 1..10: SendClientMessage(playerid, -1, "You've got a long way to go yet, Champ!");
}
return 1;
}
If you want to pause a quotation, perhaps to use a define, you don't require an ellipses, you can just end the quotation and enter the name of the define, then re-continue your quoted text, like so:
pawn Код:
#define PERSON_PHRASE "Champ"
SendClientMessage(playerid, -1, "You've got a long way to go yet, " PERSON_PHRASE "!");
I haven't really looked too far in to pawn-lang.pdf, so my information might not be entirely relevant, but what I've stated generally works - though there may be other uses for the ellipses operator.
Re: Ellipsis operator between strings -
Scottas - 21.07.2011
I know that thing with define, but it can't be used like that:
pawn Код:
print ( "First line"
"second line" );
Re: Ellipsis operator between strings -
Vince - 21.07.2011
Quote:
Originally Posted by Calg00ne
The ellipses operator is used for signalling a difference between integers. You can use it in switch cases, like so:
pawn Код:
case 1...10: SendClientMessage(playerid, -1, "You've got a long way to go yet, Champ!");
|
That's actually not correct, because you use only 2 dots in a switch statement. The only use for the elipsis operator I can find (other than ******' post) is to initialize variables with an invalid value, for example:
pawn Код:
new Text:gPlayerText[MAX_PLAYERS] = {INVALID_TEXT_DRAW, ...};
Re: Ellipsis operator between strings -
Scottas - 21.07.2011
Thanks for answers.
******, this gives me an error:
pawn Код:
print ( "first line"
"second line" );
Код:
error 001: expected token: ",", but found "-string-"
All I need is to put '\' at the end of first line, and it compiles fine.
Re: Ellipsis operator between strings -
Scottas - 21.07.2011
I am using line breaks when string line becomes to long, so I don't need to scroll to right
Re: Ellipsis operator between strings -
RSX - 21.07.2011
Actually that's useful in cases when you need to have really long string, that exceeds the defined maximum length of a line, so that's highly useful..
Quote:
That's actually not correct, because you use only 2 dots in a switch statement. The only use for the elipsis operator I can find (other than ******' post) is to initialize variables with an invalid value, for example:
|
pawn Код:
new Text:gPlayerText[MAX_PLAYERS] = {INVALID_TEXT_DRAW, ...};
This code is equal to memset(...) basically it means that you fill the array (also in syntax { } structure is array) with the value. So it's not really meant only for invalid.
Edit : Ftw Lietuvai!
Re: Ellipsis operator between strings -
Patrik356b - 21.07.2011
Quote:
Originally Posted by ******
What are you on about? There is no mention of "void" or "register" anywhere in the current documentation. As for "strcopy", that's a new function introduced since SA:MP's version of PAWN.
|
If you write "void" or "register" it will be highlighted like if you wrote "public"
And strcopy/strcpy (one of them, i dont remember which one) is mentioned in the pawn docs, but doesn't exist in sa-mp's versino of pawno