Console Output
Authors: ForeverZer0
Version: 1.0
Type: Scripting Tool
Key Term: Scripting Tool
IntroductionRedirects output using the "puts" command to a seperate console, instead of using the normal pop-up windows.
Noy 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.
ScreenshotsNone.
DemoNone.
ScriptHere.
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
InstructionsPlace the script anywhere you like.
In script calls or within scripts, output to it using "puts" instead of the normal "p" or "print".
CompatibilityShouldn't be any.
Credits and Thanks
- ForeverZer0, for the script.
Author's NotesPlease report any bugs/issues/suggestions. I will be happy to fix them.
Enjoy!