Skip to content

Commit

Permalink
Just add a little inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nickavv committed Aug 19, 2020
1 parent de9d04b commit 21f88dd
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions rt-shell/scripts/scr_shell_scripts/scr_shell_scripts.gml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function sh_get_bgspeed() {
return "hspeed: " + string(bgHspeed) + ", vspeed: " + string(bgVspeed);
}

// If you want a method to take arguments at the command line, pass in an args object here
// args[0] will always be the function name, args[1] and onwards will be your actual arguments
function sh_set_bg_hspeed(args) {
var newHspeed = args[1];
try {
Expand All @@ -28,6 +30,17 @@ function sh_set_bg_vspeed(args) {
}
}

// Here is an example of a shell script that takes multiple command line arguments
// See how I've assigned args[1], args[2], and args[3] into local variables for easier use
function sh_set_bg_color(args) {
var red = args[1];
var green = args[2];
var blue = args[3];

var backgroundId = layer_background_get_id(layer_get_id("Background"));
layer_background_blend(backgroundId, make_color_rgb(red, green, blue));
}

function sh_test_duplicate_spawn() {
instance_create_layer(0, 0, "Instances", obj_shell);
}
Expand All @@ -44,12 +57,3 @@ function sh_say_greeting(args) {
var whomToGreet = args[1];
return "Hello " + whomToGreet + "!";
}

function sh_set_bg_color(args) {
var red = args[1];
var green = args[2];
var blue = args[3];

var backgroundId = layer_background_get_id(layer_get_id("Background"));
layer_background_blend(backgroundId, make_color_rgb(red, green, blue));
}

0 comments on commit 21f88dd

Please sign in to comment.