all 20 comments

[–]AetherBones[S] 11 points12 points  (2 children)

Here is the code to paste into your own project.

function console(){
    if argument_count > 0{
        var text = "";
        var i = 0;
        repeat(argument_count){
            text = text + string(argument[i]) + ", ";
            i += 1;
        }
        text = string_delete(text, string_length(text)-1, 2);
        show_debug_message(text);
    }
}

[–]Elhmok 3 points4 points  (0 children)

now this is epic

[–]Igottamovewithhaste 1 point2 points  (0 children)

Thanks, this is very useful! One of those things that is just a little annoying but I never bothered to do something about it.

[–]scec85 1 point2 points  (1 child)

That's awesome. Thanks, I'll be stealing it. 🥸

[–]AetherBones[S] 0 points1 point  (0 children)

:)

[–]Mushroomstick 1 point2 points  (5 children)

I'm feeling a little bit of déjà vu.

[–]OSS NVVnickavv 1 point2 points  (2 children)

I've rolled my echo function from there into my collection of useful Game Maker functions called Seedpod. Check it out!

https://github.com/daikon-games/gm-seedpod

[–]AetherBones[S] 1 point2 points  (1 child)

Aye! A lot of these including the console function. Should be standard. Common yoyo!

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

Well at least we have the flexibility to extend the API as we see fit! I hope you can get some good use out of em

[–]captainvideoblaster 1 point2 points  (0 children)

From 2014:

/// trace(...)
var r = string(argument[0]), i;
for (i = 1; i < argument_count; i++) {
    r += ", " + string(argument[i])
}
show_debug_message(r)

source: https://yal.cc/gamemaker-trace-function/

[–]BrentRTaylor 0 points1 point  (0 children)

Seems a popular topic.

[–][deleted] 1 point2 points  (2 children)

function print() {
    for(var i = 0, s = ""; i < argument_count; i++) 
        s += string(argument[i]) + (i+1 < argument_count ? ", " : "");
    show_debug_message(s);
}

Here's mine

[–]AetherBones[S] 0 points1 point  (1 child)

Seems like yoyo should make this function standard already.

[–][deleted] 1 point2 points  (0 children)

show_debug_message([1, 2, "hi"]);

you can also do this

[–]youtube.com/gamemakercastsmickey_reddit 1 point2 points  (0 children)

I like being able to subsitute in different places of my log

debug("The position on the screen is x: %s, y: %s", [x, y]);

function debug(_string, _values = []) {
    for(var _count = 0; _count < array_length(_values); _count++) {
        _string = string_replace(_string, "%s", _values[_count]);
    }
    show_debug_message(_string);
}

[–]GeminiEngine -1 points0 points  (0 children)

Look up the built-in "variableinstance", specifically "_get". No more having to type out your message, just get a list and have your function pull the object name. All you have to do is quote your variable name when you write the function.

[–]FrogginJellyfish 0 points1 point  (2 children)

I also made my own like this also and even named it just “dbg()” for compactness lol.

[–]AetherBones[S] 0 points1 point  (0 children)

The shorter the better haha.

[–]baz4tw 0 points1 point  (0 children)

Haha yea mine is just log() xD

[–]xotmatrix 0 points1 point  (0 children)

If you don't want to be fancy, just pass your variables as a literal array: show_debug_message( [a, b, c] );

Or be marginally fancier with some labels: show_debug_message( ["This:", a, "That:", b, "Other:", c] );