SA-MP Forums Archive
PAWN printing line number? - 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: PAWN printing line number? (/showthread.php?tid=358521)



PAWN printing line number? - MP2 - 10.07.2012

I know what the answer is going to be but, is there by any chance a way of printing what line a certain piece of code is on? At a wild guess something like

pawn Код:
print("Hello, I am on line "#line"!");
?

I doubt it for some reason.


Re: PAWN printing line number? - Roko_foko - 10.07.2012

Yes, I think it is posible.
I see only one way of doing it.
I know how to do it in Dev C++ and I think you can here as well.
You need know how to use file functions as fscanf( I think this exist in pawn aswell)
Open your gamemode, in the same way you are opening your scriptfiles. And chech line by line ( using counter) and once you with strcmp get te exact line you can print it.

If some lines are same, use comments( /* //)


Re: PAWN printing line number? - Vince - 10.07.2012

Sadly, it's not possible. I once searched for it as well. The manual refers to __line as a predefined constant (page 104), but that one doesn't work. Unlike __Pawn (which shows the current Pawn version in BCD) which does work.


Re: PAWN printing line number? - JoBullet - 10.07.2012

It is not possible.
#line directive sets (internally, for compiler uses) line number.

EDIT: You could actually do it because it's saved for debug purposes(debug level should be set accordingly) but there would be a lot of boiler-plate(because you cannot make #emit into macro)


Re: PAWN printing line number? - Vince - 10.07.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
Which manual did you check? The one from the website (new version) or this one (SA-MP version):

https://sampforum.blast.hk/showthread.php?tid=289258
Neither. I have this version of August 2007.
For reference: https://dl.dropbox.com/u/60044532/pawn-lang.pdf