Command-line Args Loader
This script simply loads any command-line arguments into ARGV. RM doesn’t do this natively so we need to do it ourselves. This script is meant to be used for games that will be using custom game launchers that will supply command-line arguments.
Download
Script: download here
Installation
In the script editor, place this above Modules
Usage
Access command-line arguments using ARGV variable in your scripts.
For your launchers, you would execute Game.exe
and pass in your desired arguments.
Example
f you started the game using
game.exe test debug "some value"
You will get the following array in ARGV
["test", "debug", "some value"]
You can then use array operations to control how the game will respond depending on what kind of arguments are passed in. A simple example is when you want to set a switch when the argument “enable_debug” is passed in
$DEBUG = false if ARGV.include?("enable_debug") $DEBUG = true end
Notes
This script does not provide extra behavior when options are involved and does not parse them into a hash of options.
The usage of the script should of been more like the code I provided most of your other usage examples have been better this one was little useless, but I hope others will see this comment.
Code:
if !ARGV.include?("ARGUMENT CHECK")
if ARGV.include?("test") or ARGV.include?("debug")
#Do Something
else
#Do Something then exit
exit
end
end
You’re right, given the nature of the script, it would be more useful to show how it would be used.
Cool, I find most of your posts useful and I did find this one useful as it did most of the leg work for me, but just thought there was something missing 🙂 also how would I dump all the arguments that have been passed to it?
What do you mean by “dump all the arguments”? Print it out?