Yeah it's a small thing but I like to see clean compiles and many times those "unused" variables are used simply because they get assigned a value.
Anyway can you please give us a setting in eCompile.cfg for this.
Also, if you could address the case 'default' issue I posted about too.
Setting to disable "unused variable" warnings in e
Moderator: POL Developer
Why do you need to create a variable only to assign a value to it, if you aren't going to use the value? And for that matter, doesn't assigning a value to a variable count as it being used? Isn't it only when you have a function parameter or a declared local var that you never use at all that this warning comes?
The biggest time this happens to me is with standard scripts for things like dot-commands or UseScripts, where the basic parameters are not used in the script; For instance, a dot-command that does not need to use the Char Ref or Text values; I prefer leaving the parameters defined just in case I might need them in the future (yes, I know it'd be easy as pie to add them back!), and I don't like doing the "who:=who;" trick)
Erm... with all that said; I have to agree that an ecompile.cfg option for this would be nice, to address the issue I note above. Of course, I'll live without it, but if it's an easy option to add, it'd be nice, indeed!!
The biggest time this happens to me is with standard scripts for things like dot-commands or UseScripts, where the basic parameters are not used in the script; For instance, a dot-command that does not need to use the Char Ref or Text values; I prefer leaving the parameters defined just in case I might need them in the future (yes, I know it'd be easy as pie to add them back!), and I don't like doing the "who:=who;" trick)
Erm... with all that said; I have to agree that an ecompile.cfg option for this would be nice, to address the issue I note above. Of course, I'll live without it, but if it's an easy option to add, it'd be nice, indeed!!
I think there's a better solution to avoid the spam of unused variables in textcommands and similar scripts. Actually the "trick" is to do something like
unused_var :_= unused_var;
This avoids the warning, but adds unnecessary code. Imho it would be cool to add some instruction which is used to tell the compiler "I know I'm not using that variable, please don't print warning", something like
NOUSE unused_var;
or
nouse(unused_var);
which isn't really translated in istructions
unused_var :_= unused_var;
This avoids the warning, but adds unnecessary code. Imho it would be cool to add some instruction which is used to tell the compiler "I know I'm not using that variable, please don't print warning", something like
NOUSE unused_var;
or
nouse(unused_var);
which isn't really translated in istructions
An eCompile option would be the most efficient alternative and it shouldn't be that hard to code into eCompile.
I see no reason why I, or anyone else for that matter, should have to create a special line of code in my scripts (or add one to other scripts (including the Distro code)) to stop the warnings.
I gather the warnings are there to promote optimized code but there are times when a variable is declared because it has to be but never gets "used" the way eCompile defines being used. See Marilla's post as an example.
I see no reason why I, or anyone else for that matter, should have to create a special line of code in my scripts (or add one to other scripts (including the Distro code)) to stop the warnings.
I gather the warnings are there to promote optimized code but there are times when a variable is declared because it has to be but never gets "used" the way eCompile defines being used. See Marilla's post as an example.
Actually CWO the answer to your question is "No".
Note the following from POL 96/97 Distro spellStarter.src found in \Distro\pkg\skills\magery:
The option cfg option is the best way to go.
Note the following from POL 96/97 Distro spellStarter.src found in \Distro\pkg\skills\magery:
Code: Select all
program SpellStarter(params)
var mobile := params[1]; // Caster
var spell_id := params[2]; // Id # of the spell
var scroll := params[3]; // Scroll object being used
var targ := params[4]; // NPC target //This line generates an "unused" warning and targ is definitely used here.
...
Why would that line generate a warning, but the rest don't? If that's the case, sounds to me like there's just a bug in the reporting that needs to be fixed; a bug which adding this option (which I otherwise support) would just cover up.Yukiko wrote:Code: Select all
program SpellStarter(params) var mobile := params[1]; // Caster var spell_id := params[2]; // Id # of the spell var scroll := params[3]; // Scroll object being used var targ := params[4]; // NPC target //This line generates an "unused" warning and targ is definitely used here. ...
I was just looking over this topic yesterday too thinking maybe we got an answer and I just missed it.
Now rewriting my scriptbase I've severely slashed the number of instructions my shard's scripts do (and still going) and I instated a "No compile warnings" policy for the other shard devs but its hard to enforce that with these things and still say, dont do anything thats not truely needed... its either one or the other...
Now rewriting my scriptbase I've severely slashed the number of instructions my shard's scripts do (and still going) and I instated a "No compile warnings" policy for the other shard devs but its hard to enforce that with these things and still say, dont do anything thats not truely needed... its either one or the other...