Code: Select all
Sub Main(string arg1,string arg2)
/echo Macro.Params ${Macro.Params}
/echo arg1 ${arg1}
/echo arg2 ${arg2}
/return
Moderator: MacroQuest Developers
Code: Select all
Sub Main(string arg1,string arg2)
/echo Macro.Params ${Macro.Params}
/echo arg1 ${arg1}
/echo arg2 ${arg2}
/return
donations for this month's patches.What should ${Macro.Params} be returning under the following conditions?EqMule wrote:Not a bug, all parameters default to NULL when not supplied.
Code: Select all
Sub Main
/echo ${Macro.Params}
/return
donations for this month's patches.
donations for this month's patches.Given the above case, is there any way to get the actual command line arguments?EqMule wrote: /mac test.mac 1 2 3 4Code: Select all
Sub Main /echo ${Macro.Params} /return
Code: Select all
| Macro Example to show how to get commandline variables without screwing up the macro engine with undeclared variables:
| EqMule 2017
#turbo
Sub Main
/declare pi int local
/declare NumParams int local
| Check for command line variables
/if (${Macro.Params}) {
/varset NumParams ${Math.Calc[${Macro.Params}-1]}
}
/if (${Macro.Params}) {
/for pi 0 to ${NumParams}
/echo Commandline arg ${pi} is: ${Param${pi}}
/next pi
}
/return
Commandline arg 0 is: 1
Commandline arg 1 is: 2
Commandline arg 2 is: Hi There
donations for this month's patches.