parameter_string

Returns the specified command-line parameter.

Syntax:

GML Code Example

parameter_string(n);


Returns: String


Description

Command-line parameters are those extra commands that you can add to an exe to change how the program is run and with this function you can get the chosen command-line parameter as a string. You can find the number of parameters for the current game using the function parameter_count, where the first parameter has index 1 and the last one has the index returned by the function (a value of 0 is special on that it is the filename of the game executable, including the path). It should be noted that this function will work for on the HTML5 platform, retrieving the url parameters.


Example:

GML Code Example

var p_num;
 p_num = parameter_count();
 if p_num > 0
    {
    var i;
    for (i = 0; i < p_num; i += 1)
       {
       p_string[i] = parameter_string(i + 1);
       }
    }
 

The above code will get the number of command-line parameters, and if there is 1 or more it will loop through them and store them as strings in an array.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here