Here is the code: http://pastie.org/pastes/1466209/text
Note that there is a function called sfx. But other functions also have sfx as the name of an argument.
Code: Select all
function shot_sfx(attacker, defender, hit, sfx, miss_sfx)
function hit_or_miss(mob, hit, sfx, miss_sfx)
I'm getting this error message:
I'm not sure what are the scope rules of eScript, and if this is just a "misguided" error messages, as many ecompile throws, but if ecompile isn't making a mistake, and the scope of eScript is anything like C's scope, there's a bug there. The fact that sfx is the name of an argument of those functions should shadow the global function sfx.Compiling: ./scripts/combat_fx.src
Expected '(' after function name 'sfx'
Error getting arguments for function PlaySoundEffect
File: /opt/pol099/pkg/combat/scripts/combat_fx.src, Line 46
Error compiling statement at /opt/pol099/pkg/combat/scripts/combat_fx.src, Line 46
Error in function 'shot_sfx', File: /opt/pol099/pkg/combat/scripts/combat_fx.src, Line 46
Error in function 'shot_sfx'.
File: /opt/pol099/pkg/combat/scripts/combat_fx.src, Line 46
If I change the name of the function sfx to do_sfx(), the error disappear and ecompile compiles the code with no complaints.
Could someone tell me if this is a bug or not? It looks very much like so, but I may be doing something wrong; or I was right about the bevahior (i.e. ecompile wasn't compiling because of name conflicts), but the behavior (paramenter name not shadowing external name) is intentional (maybe the language was designed that way, which I kinda doubt).
I'm running POL 099 on Linux.