Using Colon instead of Paren. to define params in #define - 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: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Using Colon instead of Paren. to define params in #define (
/showthread.php?tid=106828)
Using Colon instead of Paren. to define params in #define -
Daren_Jacobson - 05.11.2009
I was just curious if anyone had found a way to use characters besides () to enclose the (well, i don't even want to enclose is) parameters
example:
pawn Код:
#define Coord:%1 Float:%1x, Float:%1y, Float:%1z
new Coord:pPos;
as i was writing this i realized it wouldn't be as effective as i thought. Because in order to pass the coords you would have to do
pawn Код:
Functionthatneeds3floatspassed(Coord:pPos);
but meh, I still want to know.
Edit:FAIL, that would be putting Float: infront of the vars, it may give errors, or it may just cast them to the tag they already are.
Re: Using Colon instead of Paren. to define params in #define -
Daren_Jacobson - 05.11.2009
i just read that thread, and read the guide last sunday completely through, searched it again today to see if there was anything on this.
but i am guessing the answer is no.
edit: FAIL, again on my part, just went to your thread and saw that you use this (sort of), now i am wondering why it gave me like 500 errors (8)
edit2: thinking i am on to something by doing this, experimenting now
pawn Код:
#define Coord:%1(%2) Float:%1x, Float:%1y, Float:%1z
edit3: this requires me to do
me no-likey
edit4: Half win. i got it too work by doing this
pawn Код:
#define Coord:%1; Float:%1x, Float:%1y, Float:%1z;
(the semicolons)
but now it won't really work for passing it to a function, (i got around the re-casting the tag)