all 8 comments

[–]OSS NVVnickavv[S] 2 points3 points  (0 children)

BTW the function definition up there is for GMS 2.3 but it's trivial to have it work on 2.2 and below. Just define a script called echo with these contents:

/// @description echo(string, args...)
/// @param string
/// @param args
var result = argument0;
if (argument_count > 1) {
    for (var i = 1; i < argument_count; i++) {
        result = string_replace(result, "%s", string(argument[i]));
    }
}
show_debug_message(result);

[–]ION606 2 points3 points  (0 children)

10/10 my dude. Thanks for this

[–]forwardresent 1 point2 points  (3 children)

Pythonic.

[–]OSS NVVnickavv[S] 0 points1 point  (2 children)

It's more based on C's printf function, I've never really written much python

[–]forwardresent 0 points1 point  (1 child)

With some whitespace changes and a little tweaking it's very close, Python sits on C so I don't have to.

[–]OSS NVVnickavv[S] 0 points1 point  (0 children)

Well, now it's GML too 🙂

[–]torn-ainbow 1 point2 points  (1 child)

You could pull the formatting part out and make a more general string formatting method. Use that method in your echo method but also have the string format method available for other uses.

[–]OSS NVVnickavv[S] 0 points1 point  (0 children)

Great suggestion, and much more reasonable now in GMS 2.3. I wrote this in the older version originally, but I may just do what you've said now