#define Test(%0,%1,%2) forward @%0(%2); public @%0(%2) { CallRemoteFunction(#%0,%1,%2); } forward %0(%2); public %0(%2)
Test(FuncTest, "is", playerid, string[]) {
printf("%i %s", playerid, string);
return 1;
}
#define Test(%0,%1,%2) forward @%0(%2); public @%0(%2) { CallRemoteFunction(#%0,#%1,%2); } forward %0(%2); public %0(%2)
Test(FuncTest, "is", playerid)
{
printf("is", playerid);
return 1;
}
I'm not actually sure what it is supposed to do. I spotted one bug straight away. Your calling a function with CallRemoteFunction but it has not yet been forwarded or defined.
|
forward @FuncTest(playerid, string[]);
public @FuncTest(playerid, string[]) {
CallRemoteFunction(#FuncTest, "is", playerid, string[]); //And what will replace it is with '[]' thus giving the compilation error!
}
forward FuncTest(playerid, string[]);
public FuncTest(playerid, string[]) {
printf("%i %s", playerid, string);
return 1;
}
Test(FuncTest, "i", playerid) { //Compile
printf("%i", playerid);
return 1;
}
Test(FuncTest, "s", string[]) { //Does not Compile
printf("%s", string);
return 1;
}
I edited my post maybe that helps you?
Yeah i wasn't thinking straight. |
Then you went wrong somewhere because I can assure that I've been using that exact technique for quite a while now in many places.
|
#define string:
#define TYPES:%0) _:TYPE_N:TYPE_M:##%0,,)
#define TYPE_N:TYPE_M:##,,) "")
#define TYPE_M:##%2,%3) TYPE_0:TYPE_1:TYPE_E:##|||%2|||%3)
#define TYPE_0:TYPE_1:TYPE_E:#%0#%1|||%2[%8]%9|||%3,%4) TYPE_0a:TYPE_0b:#%0#%1|||%2|||%3,%4)
#define TYPE_0a:TYPE_0b:#%0#%1|||%9string:%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0s#%1,%2|||%3|||%4)
#define TYPE_0b:#%0#%1|||%2|||%3,%4,%5) TYPE_0:TYPE_1:TYPE_E:#%0ai#%1,%2,%3|||%4|||%5)
#define TYPE_1:TYPE_E:#%0#%1|||%2|||%3,%4) TYPE_1a:TYPE_1b:#%0#%1|||%2|||%3,%4)
#define TYPE_1a:TYPE_1b:#%0#%1|||%6:%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0i#%1,_:%2|||%3|||%4)
#define TYPE_1b:#%0#%1|||%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0i#%1,%2|||%3|||%4)
#define TYPE_E:#%0#%1||||||%3) #%0#%1)
#define Test(%0,%1,%2) forward @%0(%2); public @%0(%2) { CallRemoteFunction(#%0,%1,TYPES:%2); } forward %0(%2); public %0(%2)
Try this:
http://slice-vps.nl/ppg/ Put your code in there and click "Show preprocessed output" and you can see how all the macros expand one-by-one to give the outputs. Edit: I ran those macros in the link I gave and discovered a possible problem - you are still explicitly passing "is" when you don't need to any more. EITHER generate the specifier automatically OR give it explicitly - don't do both. |
CallRemoteFunction(#FuncTest,_:TYPE_N:TYPE_0:TYPE_1a:TYPE_0a:TYPE_0b:#i#, playerid||| string|||,);
You do not remember what? And it's not buggy, you've not read the section in my other topic on strings properly.
|
CallRemoteFunction(#FuncTest,_:TYPE_N:TYPE_0:TYPE_1a:TYPE_0a:TYPE_0b:#i#, playerid||| string|||,);
If that's the result then you haven't understood perfectly what I said.
|
#define string:
#define TYPES:%0) _:TYPE_N:TYPE_M:##%0,,)
#define TYPE_N:TYPE_M:##,,) "")
#define TYPE_M:##%2,%3) TYPE_0:TYPE_1:TYPE_E:##|||%2|||%3)
#define TYPE_0:TYPE_1:TYPE_E:#%0#%1|||%2[%8]%9|||%3,%4) TYPE_0a:TYPE_0b:#%0#%1|||%2|||%3,%4)
#define TYPE_0a:TYPE_0b:#%0#%1|||%9string:%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0s#%1,%2|||%3|||%4)
#define TYPE_0b:#%0#%1|||%2|||%3,%4,%5) TYPE_0:TYPE_1:TYPE_E:#%0ai#%1,%2,%3|||%4|||%5)
#define TYPE_1:TYPE_E:#%0#%1|||%2|||%3,%4) TYPE_1a:TYPE_1b:#%0#%1|||%2|||%3,%4)
#define TYPE_1a:TYPE_1b:#%0#%1|||%6:%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0i#%1,_:%2|||%3|||%4)
#define TYPE_1b:#%0#%1|||%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0i#%1,%2|||%3|||%4)
#define TYPE_E:#%0#%1||||||%3) #%0#%1)
#define Test(%0,%1) forward @%0(%1); public @%0(%1) { CallRemoteFunction(#%0,TYPES:%1); } forward %0(%1); public %0(%1)
Test(FuncTest, playerid, string[]) {
printf("%i %s", playerid, string);
return 1;
}
#define string:
#define TYPES:%0) _:TYPE_N:TYPE_M:##%0,,)
#define TYPE_N:TYPE_M:##,,) "")
#define TYPE_M:##%2,%3) TYPE_0:TYPE_1:TYPE_E:##|||%2|||%3)
#define TYPE_0:TYPE_1:TYPE_E:#%0#%1|||%2[%8]%9|||%3,%4) TYPE_0a:TYPE_0b:#%0#%1|||%2|||%3,%4)
#define TYPE_0a:TYPE_0b:#%0#%1|||%9string:%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0s#%1,%2|||%3|||%4)
#define TYPE_0b:#%0#%1|||%2|||%3,%4,%5) TYPE_0:TYPE_1:TYPE_E:#%0ai#%1,%2,%3|||%4|||%5)
#define TYPE_1:TYPE_E:#%0#%1|||%2|||%3,%4) TYPE_1a:TYPE_1b:#%0#%1|||%2|||%3,%4)
#define TYPE_1a:TYPE_1b:#%0#%1|||%6:%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0i#%1,_:%2|||%3|||%4)
#define TYPE_1b:#%0#%1|||%2|||%3,%4) TYPE_0:TYPE_1:TYPE_E:#%0i#%1,%2|||%3|||%4)
#define TYPE_E:#%0#%1||||||%3) #%0#%1)
#define Test(%0,%1) forward @%0(%1); public @%0(%1) { CallRemoteFunction(#%0,TYPES:%1); } forward %0(%1); public %0(%1)
forward @FuncTest( playerid, string[]); public @FuncTest( playerid, string[]) { CallRemoteFunction(#FuncTest,_:TYPE_N:TYPE_0:TYPE_1a:TYPE_0a:TYPE_0b:#i#, playerid||| string|||,); } forward FuncTest( playerid, string[]); public FuncTest( playerid, string[]) {
printf("%i %s", playerid, string);
return 1;
}