Well, I was bored this afternoon and I realized that a command line plugin could be pretty helpful, so I hammered one out over the course of the day, and this is what I have to show for it.
Command Line Plugin - v0.91
Download Now(no example) - 101KB
Unfortunately, there's no example to go with the plugin because, honestly, it's pretty tough showing off a plugin like this. So, hopefully this is simple enough for anybody to pick up and figure out. I'll try to explain things as best as I can.
First of all, this plugin allows you to retrieve any command line arguments that were passed to your application/game at execution. These could include various options or a file to load upon start of the program. There's also an action to execute an external program with command line arguments.
Here's a list of the various conditions/actions/expressions, which should help when figuring out how to use the plugin:
Conditions:
For each argument - Loop through each command line argument sequentially. There are various expressions to retrieve information about the currently iterated argument.
Actions:
Execute file - Execute an external program and supply command line parameters for it to use. This could be used, for example, in the case of a level editor and game. The level editor could execute the game program with command line arguments telling the game what level to load. In this way, levels could be tested directly through the level editor.
Expressions:
Argument count - Get the amount of arguments that were passed to your application.
Get argument - Get the argument at the specified index(1-indexed).
Get argument name - Get the name of the argument at the specified index. In the following example -- arg=value -- "arg" is the name of the argument.
Get argument value - Get the value of the argument at the specified index. In the following example -- arg=value -- "value" is the value of the argument. If the argument does not contain a value, the return value will be the string "NULL".
Current argument - Used in conjunction with "For each argument". This gets the current argument in the loop.
Current argument index - Used in conjunction with "For each argument". This gets the current index of the loop.
Current argument name - Used in conjunction with "For each argument". This gets the name of the current argument. In the following example -- arg=value -- "arg" is the name of the argument.
Current argument value - Used in conjunction with "For each argument". This gets the value of the current argument. In the following example -- arg=value -- "value" is the name of the argument.
Hopefully that tells everybody most of what they need to know. It should be pretty easy to figure out.
Just a note about when you use this to load a file at the start of the program -- whether by dragging an a file onto the EXE or opening a file through it -- the file will always be the first argument. Also, to check that this is actually a file, you should use the "File" object to check that a file at that location with that name exists.
Well, that's it. I hope that somebody can find a use for this and that it's easy to understand. Be sure to leave any comments or suggestions you have.
Have fun.
EDIT: Forgot to mention that arguments are separated by spaces. If you want a single argument with spaces in it, put it in quotes.