Command-line Args Loader

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

commandLineArgsLoader1

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.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

5 Responses

  1. 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

  1. October 12, 2014

    […] use a script called Command-line Args Loader which will allow us to actually read command-line arguments (by default, RM doesn’t provide […]

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax