SA-MP Forums Archive
Problem with macro - 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: Problem with macro (/showthread.php?tid=112936)



Problem with macro - -xy! - 11.12.2009

Good morning. I'm making a macro in order to traverse the vector of a variable, but as I do not know much about macros, is giving an error:
Код:
error 075: input line too long (after substitutions)
Macro:
pawn Код:
#define percorrerVetor(%1[%2])\
        for(new %3; %3 < %2; %3++)\
        {\
            loopstart:\
        }\
        goto loopstart;\
And how I write this macro (or function) more readable and better performance?

Thanks!


Re: Problem with macro - yom - 11.12.2009

You have that error because you put a \ at the end, so the compiler think you want to include the next -empty- line as part of the macro.

There are other problems:

You don't have a third parameter in the pattern, but later you use %3.
You need to add a space between the pattern and the replacement.
You should put the replacement inside brackets.
You should put a ; at the end of the pattern.

pawn Код:
#define percorrerVetor(%1[%2],%3); \
{\
  for(new %3; %3 < %2; %3++)\
  {\
    loopstart:\
  }\
  goto loopstart;\
}