CommandHelper

CommandHelper

46.5k Downloads

Code in auto_include.ms is executed on every alias usage

KanoAlgiz opened this issue ยท 3 comments

commented

in auto_include.ms:
console('i want to be executed only on recompile!')

in aliases.msa
/test = console('good luck with that')

code in auto_include will be fired on every /test command usage by any player or from console

commented

The auto_include.ms file is intended for procedure declarations. If you want code to run only once on recompile, then you'd have to put it in another .ms file instead (e.g. main.ms). Read the part under main.ms, auto_include.ms, and aliases.msa in the Advanced Guide for a more precise explanation of what each file does.

commented

Thank you!
But is it necessary to re-register all procs defined there on every alias usage?

commented

Following the intention of how things should work (ignoring some things you could currently do, but are considered bad practise), you'd either define a procedure in a 'normal' .ms file before you use it, through an include() before you use it, or in an auto_include.ms file. If you do not have good reasons to not put it in an auto_include.ms file, then it should go in there.