SA-MP Forums Archive
Error: Unmatched tilde? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error: Unmatched tilde? (/showthread.php?tid=552007)



Error: Unmatched tilde? - iWhite - 22.12.2014

Hi.

I have this error instead of my textdraws. My code:

Код:
                        new str[64], vmsek[2], vmzero[1];
			if(VM[i][VMLaikas]-floatround(VM[i][VMLaikas]/60, floatround_floor)*60 < 10)
			{
			   format(vmzero, 1, "0");
			}
			format(vmsek, 2, "%s%i", vmzero, VM[i][VMLaikas]-floatround(VM[i][VMLaikas]/60, floatround_floor)*60);
			format(str, 64, "Checkpoints:           0%i/10~n~Warnings:                 %i/3~n~Time:                  0%i:%s", VM[i][VMCP], VM[i][VMIsp], floatround(VM[i][VMLaikas]/60, floatround_floor), vmsek);
			PlayerTextDrawSetString(i, VMTDInfo[i], str);
As you can see, ~ symbols are placed correct, but error is still showing.


Re: Error: Unmatched tilde? - Sawalha - 22.12.2014

you have formatted your string 64 cells only , while it should be 94 cells.
increase the size of the str to 100 atleast.
more explain,
when you used 64 bit
it formatted only:
pawn Код:
"Checkpoints:           0%i/10~n~Warnings:                 %i/3~n //" look here, missing '~' cuz of small string size
That leaded to an error.


Re: Error: Unmatched tilde? - Threshold - 22.12.2014

I have sometimes come across this issue when I place a character than often represents another 'shortcut'.

Valid shortcuts are:
Код:
~w~ = white
~r~ = red
~g~ = green
~l~ = black
~y~ = yellow
~p~ = pink
~b~ = blue
~n~ = new line
~h~ = lighter color
~k~ = key mapping
So if I do:
pawn Код:
~n~What?
It will normally think that I am trying to do:
pawn Код:
~w~hat?
and will give me an unmatched tilde error. So what I suggest you do, is leave a space between letters that often represent other codes, like so:

pawn Код:
format(str, 64, "Checkpoints:           0%i/10~n~ Warnings:                 %i/3~n~ Time:                  0%i:%s", VM[i][VMCP], VM[i][VMIsp], floatround(VM[i][VMLaikas]/60, floatround_floor), vmsek);
pawn Код:
new str[110], vmsek[4], vmzero;
    if((VM[i][VMLaikas] - floatround(VM[i][VMLaikas] / 60, floatround_floor) * 60) < 10) vmzero = 0;
    format(vmsek, sizeof(vmsek), "%d%i", vmzero, (VM[i][VMLaikas] - (floatround(VM[i][VMLaikas] / 60, floatround_floor) * 60)));
    format(str, sizeof(str), "Checkpoints:           0%i/10~n~ Warnings:                 %i/3~n~ Time:                  0%i:%s", VM[i][VMCP], VM[i][VMIsp], floatround(VM[i][VMLaikas] / 60, floatround_floor), vmsek);
    PlayerTextDrawSetString(i, VMTDInfo[i], str);



Re: Error: Unmatched tilde? - iWhite - 22.12.2014

Yeah, my bad. Letter counter didn't count empty spaces between words and I got only 60 cells.
Thanks!