SA-MP Forums Archive
@emit - 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)
+---- Forum: Discussion (https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: @emit (/showthread.php?tid=431139)



@emit - Slice - 13.04.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
...
Nice find ******! This also allows inserting code at the end of a line!

pawn Код:
#define EAT_LINE:%0\10;%1 The line contained: <%0> nom nom

EAT_LINE:boop boop () {}



Re: Today I learned - Share your newly found knowledge! - xeeZ - 16.04.2013

Wonderful! I just wrote a new new macro for asm.inc using this trick

pawn Код:
// Looks pretty much like inline assembly
@emit proc      ;
@emit push_s    12;
@emit push_c    4;
@emit sysreq_d  GetNativeAddressFromName("print");
@emit stack     8;
@emit retn      ;
Edit:

Oh, and today I learned how to include spaces in macros!


Re: Today I learned - Share your newly found knowledge! - xeeZ - 16.04.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
Ha! You beat me to it... There is a note on the corner of the bit of paper in front of me that just says "@emit", reminding me to write exactly that macro later tonight (I went for @emit instead of just emit as I thought it looked more like #emit, but that's a minor point).
Hmm, that's actually a good idea, it looks even better that way


Re: Today I learned - Share your newly found knowledge! - Slice - 16.04.2013

Quote:
Originally Posted by xeeZ
Посмотреть сообщение
Wonderful! I just wrote a new new macro for asm.inc using this trick

pawn Код:
// Looks pretty much like inline assembly
@emit proc      ;
@emit push_s    12;
@emit push_c    4;
@emit sysreq_d  GetNativeAddressFromName("print");
@emit stack     8;
@emit retn      ;
Edit:

Oh, and today I learned how to include spaces in macros!
You could match \10 in the end to avoid the semicolon.

pawn Код:
#define @emit%0\32;%1\32;%2\10; asm_emit_%1(ctx, %2);



Re: Today I learned - Share your newly found knowledge! - Slice - 16.04.2013

@******:
It doesn't, actually. The lst will show the output without the newline character, but it still counts it as a new line.

I tried putting a bunch of them together, which ended up with 4000 chars on one line, but it compiled just fine.