SA-MP Forums Archive
"\" in textdraws - 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: "\" in textdraws (/showthread.php?tid=301704)



"\" in textdraws - |-Ruben-| - 05.12.2011

Hi, sorry if the post is already requested, but i haven't found nothing about this.

Now to the problem:

I have created with the useful Zamaroht's "Textdraw Editor" a speedometer graphic (as you can see in the screen)



But when i must insert the code into pawn, i reach this error code:

Код:
C:\Users\Ruben\Desktop\SGW!\filterscripts\ce.pwn(48) : error 037: invalid string (possibly non-terminated string)
C:\Users\Ruben\Desktop\SGW!\filterscripts\ce.pwn(48) : warning 215: expression has no effect
C:\Users\Ruben\Desktop\SGW!\filterscripts\ce.pwn(48) : error 001: expected token: ";", but found ")"
C:\Users\Ruben\Desktop\SGW!\filterscripts\ce.pwn(48) : error 029: invalid expression, assumed zero
C:\Users\Ruben\Desktop\SGW!\filterscripts\ce.pwn(48) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Code:
Textdraw1 = TextDrawCreate(618.000000, 325.000000, "\");

The code is referring at the "\" (in the picture, is in the right)
Because in fact when i put Textdraw1 = TextDrawCreate(618.000000, 325.000000, "someothertext"); it works!




Solutions?


Re: "\" in textdraws - Pinguinn - 05.12.2011

Because \ is also used as an escaping character


Re: "\" in textdraws - MP2 - 05.12.2011

Show the line where the error is.


Re: "\" in textdraws - |-Ruben-| - 05.12.2011

Quote:
Originally Posted by Pinguinn
Посмотреть сообщение
Because \ is also used as an escaping character
So why in the editor is possible?

The problem is the pawn editor? If I use another editor such as "SAMP editor"?


Re: "\" in textdraws - Hiddos - 05.12.2011

@MP2: He did show it.

Pinguinn is right, the backslash is an escaping character. To tell the compiler you actually want to use it, you need to type it twice:

pawn Код:
Textdraw1 = TextDrawCreate(618.000000, 325.000000, "\\");



Re: "\" in textdraws - |-Ruben-| - 05.12.2011

EDIT: Thanks Hiddos!
I have fixed.