.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...
Posts | ||
---|---|---|
qc++ working with #define | Locked | |
Thread Options | ||
|
Nov 27 2014 Anchor | |
This pre-compiler is very obtuse! And stubborn. This is my code segment I'm replacing with a define: if (self.lip == 1) Pretty easy right? You can NOT do this: #define frpr(fcnt,frid) if (self.lip == fcnt) { bprint(" --- frid ->\n"); frid(); }; In fact you can NOT put any bprint("text"); in a define at all... NONE of these work: #define prlin(a) #a // also no worky You HAVE to do this: #define prl2 bprint(" --- "); #define frpr(fcnt,frid) if (self.lip == fcnt) { prl2 bprint(#frid); prl3 frid(); }; Code: frpr(2,army_walk1); Thus: --- army_walk1 -> I am thinking of trying this: #define qt2 " #define ptest(str1) bprint(qt2test print: qt2); bprint(#str1); bprint(qt2\nqt2); And just a followup note to anyone that starts coding with #define pseudo functions: You can NOT have numerals [0-9] in parameters! When I tried to compile the code with str1, it does this: compiling client.qc So I changed str1 to str and qt2 to qtt. No worky: #define qtt " #define ptest(str) bprint(qtt test print: qtt); bprint(#str); bprint(qtt \n qtt); code: ptest(seven); result: Another interesting bit: You _can_ put a bprint(" text "); in a macro call. Thus: framerloop($stand1, $stand9, hknight_stand1, 0.1,ai_stand(); bprint(" --- hknight_stand1 in loop ! \n");); Edited by: numbersix |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.