Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
ForeverZer0

Console Debug

Recommended Posts

Console Debug

Authors: ForeverZer0

Version: 1.0

Type: Scripting Tool


Introduction

 

Redirects output using the "puts" command to a seperate console, instead of using the normal pop-up windows.

Not much more to it than that.


Features

 

  • Simple.
  • No annoying pop-up windows, though they still do have their uses.
  • Automatically sets the console window the background.


Screenshots

 

None.


Demo

 

None.


Script

 

Here.

 

if $DEBUG || $TEST
 # Create a console object and redirect standard output to it.
 Win32API.new('kernel32', 'AllocConsole', 'V', 'L').call
 $stdout.reopen('CONOUT$')
 # Find the game title.
 ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
 title = "\0" * 256
 ini.call('Game', 'Title', '', title, 256, '.\\Game.ini')
 title.delete!("\0")
 # Set the game window as the top-most window.
 hwnd = Win32API.new('user32', 'FindWindowA', 'PP', 'L').call('RGSS Player', title)  
 Win32API.new('user32', 'SetForegroundWindow', 'L', 'L').call(hwnd)
 # Set the title of the console debug window'
 Win32API.new('kernel32','SetConsoleTitleA','P','S').call("#{title} :  Debug Console")
 # Draw the header, displaying current time.
 puts ('=' * 75, Time.now, '=' * 75, "\n")
end

 

 

To give the ouput the same functionality of the "p" method where it shows the inspected object, just add this code any 'ol where:

 

 

alias zer0_console_inspect puts
def puts(*args)
 inspected = args.collect {|arg| arg.inspect }
 zer0_console_inspect(*inspected)
end

 


 

Instructions

 

Place the script anywhere you like.

In script calls or within scripts, output to it using "puts" instead of the normal "p" or "print".


Compatibility

 

Shouldn't be any.


Credits and Thanks

 

  • ForeverZer0, for the script.


Author's Notes

 

Please report any bugs/issues/suggestions. I will be happy to fix them.

Enjoy!

Edited by ForeverZer0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...