console.clear()



  • This feature would not only help to remove the clutter but at the moment every single line of the console remains forever. It would be nice to have a console.lines to output the amount of lines currently written to console and console.clear(lines); allowing positive numbers to clear from the bottom and negative numbers clear from the top or the other way around.

    With those two options a user could specify how many lines they wish to keep as history in their main loop. Another potential option would be to have console.clearOlder/prune(time) to clear everything older than a specific date.

    At the moment without a clear function Screeps is a memory leak waiting to happen, it's a problem. Something went wrong in my code last night, before I went to bed I had multiple tabs open exploring rooms manually and something went wrong in my code and when I woke up every tab was using about 1GB of memory from console messages.

    Potential way to implement the feature send a :CLEAR_CONSOLE [lines] message in the console, the message does not print by default but have javascript handle it by clearing the buffer.



  • clear console... ❤
    Simple but needed


  • Dev Team

    This feature is on our roadmap.

    At the moment without a clear function Screeps is a memory leak waiting to happen, it’s a problem. Something went wrong in my code last night, before I went to bed I had multiple tabs open exploring rooms manually and something went wrong in my code and when I woke up every tab was using about 1GB of memory from console messages.

    Console should show only last 300 lines at the moment. Are you sure this leak was due to console history?




  • > This feature is on our roadmap.

    You 'da best. Thanks!



  • @Artem I'm not exactly sure what causes the memory leaks then... I've been playing for a few hours. I started off at 200,000 K memory usage and now I'm up to 932,000 K. I just assumed it was the console building up.

    Using the Steam version.


  • Dev Team

    It might be caused by another reasons. Some of them are fixed in the yesterday's patch.



  • +1 on this, It would be very handy. 


  • Dev Team

    The console clearing feature has been just added.



  • > The console clearing feature has been just added.

    How do I use it? Haven't found in the API. Or did you mean the button in the UI?


  • Culture

    > The console clearing feature has been just added.

    How do I use it? Haven't found in the API. Or did you mean the button in the UI?

     

    You can inject javascript into the console.log. So you can basically call the UI function yourself. This worked for me.

    function clearLog(){
    console.log("<script>angular.element(document.getElementsByClassName('fa fa-trash ng-scope')[0].parentNode).scope().Console.clear()</script>")
    }

     

     



  • > The console clearing feature has been just added.

    How do I use it? I can't find anything in the documentation.

    console.clear(); does not work.



  • So what's the command? Anybody found out in the last 7 month since the feature (allegedly) got implemented?