View Single Post
Old 17/06/2015, 06:00 PM   #2
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 882
Reputation: 317
Default Re: Known Runtime/Compiler PAWN Bugs

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.

Last edited by Yashas; 03/07/2015 at 01:11 AM.
Yashas is offline   Reply With Quote