17.06.2015, 18:00
(
Last edited by Yashas; 03/07/2015 at 01:11 AM.
)
12)
- Code
Code:#if defined FILTERSCRIPT public OnFilterScriptInit() { new idx = funcidx("OnPlayerCommandPerformed"); if(idx == -1) { #emit LOAD.S.alt idx } } #else public OnGameModeInit() { new idx = funcidx("OnPlayerCommandPerformed"); if(idx != -1) { #emit LOAD.S.alt idx } } #endif
- Problem
You get this error "error 017: undefined symbol "idx" though there is no error.
If you are using a gamemode (it will give rise to an error in OnFilterscriptInit), then the compiler gives that error for the line "#emit LOAD.S.alt idx" which is inside OnFilterScriptInit.The compiler isn't supposed to check OnFilterScriptInit because #if defined FILTERSCRIPT will fail.The compiler ignores the "new idx" because the #if failed but it doesn't ignore "#emit LOAD.S.alt idx".
The generalized version of this bug is that #emit code when placed inside #if is always added irrespective of the falsity of the condition given to #if.
- Solution:
The solution here is to make idx a global variable and change your inline assembly so that it will work with global variable.