Console Script
Version: 2
Introduction
This script adds a console to your game. The console works with predifined commands whithin the CONSOLE module. The only thing you have to do is to write a command and, if necessary add 1 or more values besides the command like this: command_name<x,y,z>.
Here's an exemple: You want to change the level of the first hero in the database. This command is called "actor_level" so you have to enter actor_level. Next, you have to add the id of the hero and the value of the level like this: actor_level<1,x> (Where x is the level's value).
Each commands are defined sepparetly in the script and are easly editable! You can also make your own commands within 1 or 2 minutes!
Here you have a list of predefined commands and updates.
Version 1
The original script.
Version 1.1
Now you can call the console using the tild key. sdk_enable and sdk_disable functions have been removed because they were useless. The console is only available in debug mode and you still can toogle this mode through the console.
IMPORTANT: If you turn the debug mode to off, the console won't be available. So you'll have to call the scene or toggle the debug mode through "call script".
Version 2
A new class is added to handle custom commands and a new methode is added in CONSOLE to add custom commands. It is now easy to add custom commands without messing up the script, as I did last night lol. ':|
Here's a template for custom commands:
Features
Screenshots
http://img46.imageshack.us/img46/2351/consolepicxx6.th.jpg[/IMG]
Demo
Comming soon
Script
Instructions
Copy the script above and past it above main, under all other scripts.
Call the scene with $scene = Scene_Console.new
FAQ
Q. How do you call the console?
A. Just press shift! (I will add the tild key soon)
Compatibility
Should be compatible with all script.
Credits and Thanks
Cybersam for his Full Keyboard Support module
Please, credit me ^_^
Author's Notes
The console scene is based on the chat scene in the first Netplay script.
Enjoy! ^_^
Version: 2
Introduction
This script adds a console to your game. The console works with predifined commands whithin the CONSOLE module. The only thing you have to do is to write a command and, if necessary add 1 or more values besides the command like this: command_name<x,y,z>.
Here's an exemple: You want to change the level of the first hero in the database. This command is called "actor_level" so you have to enter actor_level. Next, you have to add the id of the hero and the value of the level like this: actor_level<1,x> (Where x is the level's value).
Each commands are defined sepparetly in the script and are easly editable! You can also make your own commands within 1 or 2 minutes!
Here you have a list of predefined commands and updates.
Version 1
The original script.
- exit
- clear
- log
- toogle_debug
- help
- restart
- menu
- gameover
- sdk_help
- sdk_write
- sdk_state<script>
- sdk_enable<script>
- sdk_disable<script>
- party_help
- party_actor<x>
- party_steps<x>
- party_gold<x>
- party_item
- party_add_item<id,number>
- party_lose_item<id,number>
- party_weapon
- party_add_weapon<id,number>
- party_lose_weapon<id,number>
- party_armor
- party_add_armor<id,number>
- party_lose_armor<id,number>
- actor_help
- actor_info<id>
- actor_level<id,level>
- actor_hp<id,hp>
- actor_maxhp<id,maxhp>
- actor_sp<id,sp>
- actor_maxsp<id,maxsp>
- actor_exp<id,exp>
Version 1.1
Now you can call the console using the tild key. sdk_enable and sdk_disable functions have been removed because they were useless. The console is only available in debug mode and you still can toogle this mode through the console.
IMPORTANT: If you turn the debug mode to off, the console won't be available. So you'll have to call the scene or toggle the debug mode through "call script".
- exit
- clear
- log
- toogle_debug
- help
- restart
- menu
- gameover
- sdk_help
- sdk_write
- sdk_state<script>
- party_help
- party_actor<x>
- party_steps<x>
- party_gold<x>
- party_item
- party_add_item<id,number>
- party_lose_item<id,number>
- party_weapon
- party_add_weapon<id,number>
- party_lose_weapon<id,number>
- party_armor
- party_add_armor<id,number>
- party_lose_armor<id,number>
- actor_help
- actor_info<id>
- actor_level<id,level>
- actor_hp<id,hp>
- actor_maxhp<id,maxhp>
- actor_sp<id,sp>
- actor_maxsp<id,maxsp>
- actor_exp<id,exp>
Version 2
A new class is added to handle custom commands and a new methode is added in CONSOLE to add custom commands. It is now easy to add custom commands without messing up the script, as I did last night lol. ':|
Here's a template for custom commands:
Code:
#==============================================================================
# ** Custom Commands Template
#==============================================================================
# Dargor
# Version 1
# 011.08.06
#==============================================================================
# What you have to know:
#
# 1- Adding Your Command
#
# To add a command, use the custom_commands methode
# Ex: CONSOLE.custom_commands(your_command_name + arguments, CONSOLE.command_def)
#
# 2- Arguments
#
# If you want to use arguments with your command (ex: actor_info<id>
# you have to add "+(/<([0-9]+)\>/.match($log)).to_s" besides your command
# if your argument has a numeric value. If the argument is a string, you must
# add "+(/<(.+?)\>/.match($log)).to_s" besides it.
#
# Ex: case command
# when "actor_info"+(/<([0-9]+)\>/.match($log)).to_s
# self.actor_info
# end
#
# 3- Multiple Arguments
#
# To use more than 1 argument, just put a coma between them like this:
# (/<([0-9]+),(.+?)\>/.match($log)
# The first argument is a numeric and te second is a string.
#
# 4- Creating Your Command
#
# Fisrt of all, create a new definition like this:
# def self.your_command_name (This is the same command we use in step 1)
# Next, if you are using arguments, put same thing we have used in step2/3
# below the new definition.
#
# Ex: def self.actor_info
# if (/<([1-9]+)\>/.match($log)) != nil
# (...)
# end
# end
#
# After that, you have to know that arguments are stored in variables.
# The variable for the first argument is $1, the second is $2, the third is $3
# and so on.After, the only thing you have to do is built the core of your
# command using the values of those variables(arguments) to change variables
# of the game, the name of an actor, ect.
#
# 5- Message Entry
#
# When you command is completly finished, please add this if needed after the
# script. self.add(your text here)
# This will show a message saying what have been changed.
#
#==============================================================================
# Exemple using Dubealex's AMS
module CONSOLE
#----------------------------------------------------------------------------
# Creating your own commands
#----------------------------------------------------------------------------
def self.ams_font_size
if (/<([1-9]+)\>/.match($log)) != nil
$ams.font_size = $1.to_i
self.add("AMS font size is now " + $1.to_s)
else #(if there's nothing beside the command, write the actual value)
self.add("AMS font size is " + $ams.font_size.to_s)
end
end
end
#----------------------------------------------------------------------------
# Adding your commands
#----------------------------------------------------------------------------
# This is the class for custom commands
# The only thing you have to do is to alias "refresh" and add your command
# Ex: CONSOLE.custom_commands(your_command_name + arguments, CONSOLE.command_def)
#----------------------------------------------------------------------------
class Console_Commands
alias commands_refresh refresh
def refresh
commands_refresh
CONSOLE.custom_commands("ams_font_size"+(/<([0-9]+)\>/.match($log)).to_s, CONSOLE.ams_font_size)
end
end
- SDK compatible and compliant
- Easly editable commands
- You can make your own commands
Screenshots
http://img46.imageshack.us/img46/2351/consolepicxx6.th.jpg[/IMG]
Demo
Comming soon
Script
Code:
#==============================================================================
# ** Console Script
#==============================================================================
# Dargor
# Version 2
# 11.08.06
#==============================================================================
# This script adds a console to your game. The console works with predifined
# commands whithin the CONSOLE module. The only thing you have to do is to write
# a command and, if necessary add 1 or more values besides the command like this:
# command_name<x,y,z>. Here's an exemple: You want to change the level of the
# first hero in the database. This command is called "actor_level" so you have to
# enter actor_level. Next, you have to add the id of the hero and the value of the
# level like this: actor_level<1,x> (Where x is the level's value).
# Each commands are defined sepparetly in the script and are easly editable!
# You can also make your own commands within 1 or 2 minutes!
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log("Console Script", "Dargor", 1, "11.08.06")
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state("Console Script") == true
#----------------------------------------------------------------------------
# Console Commands
#----------------------------------------------------------------------------
# This class handles custom commands. DO NOT MODIFY HERE
#----------------------------------------------------------------------------
class Console_Commands
def refresh
end
end
# Console module
module CONSOLE
@custom_commands = {}
@command_enable = {}
# Use this methode to add custom definitions
def self.custom_commands(command_name,methode)
@custom_commands[command_name] = [methode]
@command_enable[command_name] = true
end
def self.update(log)
$game_temp.console_log.push("~"+$log)
$game_temp.txt_console_log.push("~"+$log)
$console_commands.refresh
$game_temp.console_refresh = true
self.eval_commands($log)
end
def self.eval_commands(command)
case command
# search for custom commands
when "#{@custom_commands[command]}"
eval(@custom_commands[command][0])
when "exit"
exit
when "clear"
$game_temp.console_log.clear
$game_temp.console_refresh = true
when "log"
self.log
when "toogle_debug"
self.toogle_debug
when "help"
self.help
when "restart", "title"
$scene = Scene_Title.new
when "menu"
$scene = Scene_Menu.new
when "gameover"
$scene = Scene_Gameover.new
# SDK
when "sdk_help"
self.sdk_help
when "SDK_write","sdk_write"
self.sdk_write
when "SDK_state"+(/<(.+?)\>/.match($log)).to_s,"sdk_state"+(/<(.+?)\>/.match($log)).to_s
self.sdk_state
when "SDK_enable"+(/<(.+?)\>/.match($log)).to_s,"sdk_enable"+(/<(.+?)\>/.match($log)).to_s
self.sdk_enable
when "SDK_disable"+(/<(.+?)\>/.match($log)).to_s,"sdk_disable"+(/<(.+?)\>/.match($log)).to_s
self.sdk_disable
# Party
when "party_help"
self.party_help
when "party_actor"+(/<([0-9]+)\>/.match($log)).to_s
self.party_actor
when "party_steps"+(/<([0-9]+)\>/.match($log)).to_s
self.party_steps
when "party_gold"+(/<([0-9]+)\>/.match($log)).to_s
self.party_gold
when "party_item"
self.party_item
when "party_add_item"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.party_add_item
when "party_lose_item"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.party_lose_item
when "party_weapon"
self.party_weapon
when "party_add_weapon"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.party_add_weapon
when "party_lose_weapon"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.party_lose_weapon
when "party_armor"
self.party_armor
when "party_add_armor"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.party_add_armor
when "party_lose_armor"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.party_lose_armor
# Actor
when "actor_help"
self.actor_help
when "actor_info"+(/<([0-9]+)\>/.match($log)).to_s
self.actor_info
when "actor_level"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.actor_level
when "actor_hp"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.actor_hp
when "actor_maxhp"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.actor_maxhp
when "actor_sp"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.actor_sp
when "actor_maxsp"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.actor_maxsp
when "actor_exp"+(/<([0-9]+),([0-9]+)\>/.match($log)).to_s
self.actor_exp
else
unless @command_enable[command]
text = "Unknown command " + $log
self.add(text)
end
end
end
def self.add(text)
if $game_temp == nil
$game_temp = Game_Temp.new
end
$game_temp.console_log.push(text)
$game_temp.txt_console_log.push(text)
$game_temp.console_refresh = true
if $game_temp.txt_logging == false
$game_temp.txt_console_log.clear
end
end
#--------------------------------------------------------------------------
# |SDK Commands
#--------------------------------------------------------------------------
def self.sdk_help
self.add("Current 'SDK' commands are:")
self.add("sdk_write - Write all script logged in SDK to a file")
self.add("sdk_state<script> - Return the state value of a script")
#self.add("sdk_enable<script> - Enable a script")
#self.add("sdk_disble<script> - Disable a script")
end
def self.sdk_write
SDK.write
text = "Scripts logged in SDK have been written to 'Scripts List.txt'"
self.add(text)
end
def self.sdk_state
if (/<(.+?)\>/.match($log)) != nil
if SDK.state($1)
script = $1
self.add($1 + " state is " + SDK.state(script).to_s)
else
self.add("Unable to find " + $1)
end
end
end
def self.sdk_enable
self.add("Scripts can't be enabled from the console")
end
def self.sdk_disable
self.add("Scripts can't be disabled from the console")
end
#--------------------------------------------------------------------------
# |Custom Commands
#--------------------------------------------------------------------------
# Debug
def self.log
if $game_temp.txt_logging
$game_temp.txt_logging = false
self.add("Console logging deactivated")
else
$game_temp.txt_logging = true
self.add("Console logging activated")
end
end
def self.update_txt_logging
file = File.open('Console.txt', 'wb')
for i in 0...$game_temp.txt_console_log.size
file.write("#{$game_temp.txt_console_log[i]}\n")
end
file.close
end
def self.toogle_debug
if $DEBUG
$DEBUG = false
else
$DEBUG = true
end
self.add("Debug mode is " + $DEBUG.to_s)
end
# Help
def self.help
self.add("Current help commands are:")
self.add("actor_help - Show all 'actor' commands list")
self.add("party_help - Show all 'party' commands list")
self.add("sdk_help - Show all 'SDK' commands list")
self.add("Current basic commands are:")
self.add("toogle_debug - Toogle debug mode")
self.add("exit - Quit the game")
self.add("log - Toogle console logging mode")
self.add("clear - Clear the console")
self.add("restart or title - Restart the game from the title screen")
self.add("menu - Open the main menu")
self.add("gameover - Open the gameover screen")
end
# Party
def self.party_help
self.add("Current 'party' commands are:")
self.add("party_actor<id> - Get the name of the actor in the party")
self.add("party_steps<steps> - Change the steps value")
self.add("party_gold<gold> - Change the gold value")
self.add("party_item - Show a list of all owned items")
self.add("party_add_item<id,number> - Add a specific item")
self.add("party_lose_item<id,number> - Remove a specific item")
self.add("party_weapon - Show a list of all owned (and unequiped) weapons")
self.add("party_add_weapon<id,number> - Add a specific weapon")
self.add("party_lose_weapon<id,number> - Remove a specific weapon")
self.add("party_armor - Show a list of all owned (and unequiped) armors")
self.add("party_add_armor<id,number> - Add a specific armor")
self.add("party_lose_armor<id,number> - Remove a specific armor")
end
def self.party_actor
if (/<([1-9]+)\>/.match($log)) != nil
if $1.to_i >= $game_party.actors.size
self.add("Unknown actor")
else
self.add("$game_party.actors["+$1.to_s+"] is " + $game_party.actors[$1.to_i].name)
end
end
end
def self.party_steps
if (/<([0-9]+)\>/.match($log)) != nil
$game_party.steps -= $game_party.steps
$game_party.steps += $1.to_i
self.add("$game_party.steps is now " + $game_party.steps.to_s)
else
self.add("$game_party.steps is " + $game_party.steps.to_s)
end
end
def self.party_gold
if (/<([0-9]+)\>/.match($log)) != nil
$game_party.gain_gold(-$game_party.gold)
$game_party.gain_gold($1.to_i)
self.add("$game_party.gold is now " + $game_party.gold.to_s)
else
self.add("$game_party.gold is " + $game_party.gold.to_s)
end
end
def self.party_item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
self.add($data_items[i].name + ": " + $game_party.item_number(i).to_s )
end
end
end
def self.party_add_item
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_items.size
self.add("Unknown item")
else
if $2.to_i >= 0
if $2.to_i > 1
$game_party.gain_item($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_items[$1.to_i].name + "s have been added")
elsif $2.to_i == 1
$game_party.gain_item($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_items[$1.to_i].name + " have been added")
end
end
end
end
end
def self.party_lose_item
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_items.size
self.add("Unknown item")
else
if $2.to_i >= 0
if $2.to_i > 1
$game_party.lose_item($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_items[$1.to_i].name + "s have been removed")
elsif $2.to_i == 1
$game_party.lose_item($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_items[$1.to_i].name + " have been removed")
end
end
end
end
end
def self.party_weapon
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
self.add($data_weapons[i].name + ": " + $game_party.weapon_number(i).to_s )
end
end
end
def self.party_add_weapon
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_weapons.size
self.add("Unknown weapon")
else
if $2.to_i >= 0
if $2.to_i > 1
$game_party.gain_weapon($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_weapons[$1.to_i].name + "s have been added")
elsif $2.to_i == 1
$game_party.gain_weapon($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_weapons[$1.to_i].name + " have been added")
end
end
end
end
end
def self.party_lose_weapon
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_weapons.size
self.add("Unknown weapon")
else
if $2.to_i >= 0
if $2.to_i > 1
$game_party.lose_weapon($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_weapons[$1.to_i].name + "s have been removed")
elsif $2.to_i == 1
$game_party.lose_weapon($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_weapons[$1.to_i].name + " have been removed")
end
end
end
end
end
def self.party_armor
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
self.add($data_armors[i].name + ": " + $game_party.armor_number(i).to_s )
end
end
end
def self.party_add_armor
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_armors.size
self.add("Unknown armor")
else
if $2.to_i >= 0
if $2.to_i > 1
$game_party.gain_armor($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_armors[$1.to_i].name + "s have been added")
elsif $2.to_i == 1
$game_party.gain_armor($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_armors[$1.to_i].name + " have been added")
end
end
end
end
end
def self.party_lose_armor
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_armors.size
self.add("Unknown armor")
else
if $2.to_i >= 0
if $2.to_i > 1
$game_party.lose_armor($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_armors[$1.to_i].name + "s have been removed")
elsif $2.to_i == 1
$game_party.lose_armor($1.to_i,$2.to_i)
self.add($2.to_s + " " + $data_armors[$1.to_i].name + " have been removed")
end
end
end
end
end
# Actor
def self.actor_help
self.add("Current 'actor' commands are:")
self.add("actor_info<id> - Get infos on a specfic actor")
self.add("actor_level<id,level> - Change level value")
self.add("actor_hp<id,hp> - Change hp value")
self.add("actor_maxhp<id,maxhp> - Change maxhp value")
self.add("actor_sp<id,sp> - Change sp value")
self.add("actor_maxhp<id,maxsp> - Change maxsp value")
self.add("actor_exp<id,exp> - Change exp value")
end
def self.actor_info
if (/<([1-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_actors.size
self.add("Unknown actor")
else
self.add("Id: "+ $game_actors[$1.to_i].id.to_s)
self.add("Name: "+ $game_actors[$1.to_i].name)
self.add("Class: "+ $game_actors[$1.to_i].class_name)
self.add("Level: "+ $game_actors[$1.to_i].level.to_s)
self.add("Hp/MaxHp: "+ $game_actors[$1.to_i].hp.to_s+" / "+$game_actors[$1.to_i].maxhp.to_s)
self.add("Sp/MaxSp: "+ $game_actors[$1.to_i].sp.to_s+" / "+$game_actors[$1.to_i].maxsp.to_s)
self.add("Exp: "+ $game_actors[$1.to_i].exp.to_s)
end
end
end
def self.actor_level
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_actors.size
self.add("Unknown actor")
else
$game_actors[$1.to_i].level = $2.to_i
self.add("$game_actors["+$1.to_s+"].level is now " + $2.to_s)
end
end
end
def self.actor_hp
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_actors.size
self.add("Unknown actor")
else
$game_actors[$1.to_i].hp = $2.to_i
self.add("$game_actors["+$1.to_s+"].hp is now " + $2.to_s)
end
end
end
def self.actor_maxhp
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_actors.size
self.add("Unknown actor")
else
$game_actors[$1.to_i].maxhp = $2.to_i
self.add("$game_actors["+$1.to_s+"].maxhp is now " + $2.to_s)
end
end
end
def self.actor_sp
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_actors.size
self.add("Unknown actor")
else
$game_actors[$1.to_i].sp = $2.to_i
self.add("$game_actors["+$1.to_s+"].sp is now " + $2.to_s)
end
end
end
def self.actor_maxsp
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_actors.size
self.add("Unknown actor")
else
$game_actors[$1.to_i].maxsp = $2.to_i
self.add("$game_actors["+$1.to_s+"].maxsp is now " + $2.to_s)
end
end
end
def self.actor_exp
if (/<([0-9]+),([0-9]+)\>/.match($log)) != nil
if $1.to_i >= $data_actors.size
self.add("Unknown actor")
else
$game_actors[$1.to_i].exp = $2.to_i
self.add("$game_actors["+$1.to_s+"].exp is now " + $2.to_s)
end
end
end
end
#=============================================================================
# â– Input Created by: Cybersam
#-----------------------------------------------------------------------------
#  Adds full keyboard support to module Input.
#=============================================================================
module Input
#--------------------------------------------------------------------------
# â— Returns true when a key is pressed.
#--------------------------------------------------------------------------
def Input.getkey(key)
Win32API.new("user32", "GetAsyncKeyState", "i", "i").call(key) & 0x01 == 1
end
#--------------------------------------------------------------------------
# â— Returns a key's state.
#--------------------------------------------------------------------------
def Input.getstate(key)
return (not Win32API.new("user32", "GetKeyState", "i", "i").call(key).between?(0, 1))
end
end
#=============================================================================
# â– Game_Party
#=============================================================================
class Game_Party
attr_accessor :steps
end
#=============================================================================
# â– Game_Temp
#-----------------------------------------------------------------------------
#  セーブデータã«å«ã¾ã‚Œãªã„ã€ä¸€æ™‚çš„ãªãƒ‡ãƒ¼ã‚¿ã‚’扱ã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚ã“ã®ã‚¯ãƒ©ã‚¹ã®ã‚¤ãƒ³
# スタンス㯠$game_temp ã§å‚ç…§ã•ã‚Œã¾ã™ã€‚
#=============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# â— Attributes
#--------------------------------------------------------------------------
attr_accessor :console_refresh
attr_accessor :console_log
attr_accessor :txt_console_log
attr_accessor :txt_logging
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias console_initialize initialize
def initialize
console_initialize
@console_refresh = false
@console_log = []
@txt_console_log = []
@txt_logging = false
end
end
#=============================================================================
# â– Window_Console
#-----------------------------------------------------------------------------
#  Displays console messages.
#=============================================================================
class Window_Console < Window_Base
#--------------------------------------------------------------------------
# â— Initializes console window.
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 432)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 16
self.back_opacity = 160
refresh
end
#--------------------------------------------------------------------------
# â— Refreshes console window.
#--------------------------------------------------------------------------
def refresh
$game_temp.console_log.delete_at(0) while $game_temp.console_log.size > 25
self.contents.clear
for i in 0..$game_temp.console_log.size - 1
self.contents.draw_text(0, i * 16 - 8, 640, 32, $game_temp.console_log[i])
end
CONSOLE.update_txt_logging if $game_temp.txt_logging
$game_temp.console_refresh = false
end
#--------------------------------------------------------------------------
# â— Updates console window.
#--------------------------------------------------------------------------
def update
refresh if $game_temp.console_refresh
super
end
end
#=============================================================================
# â– Window_ConsoleInput Originally created by: Cybersam
#-----------------------------------------------------------------------------
#  Based on the Full-Keyboard Input script created by Cybersam.
#=============================================================================
class Window_ConsoleInput < Window_Base
#--------------------------------------------------------------------------
# â— Initializes console input window.
#--------------------------------------------------------------------------
def initialize
super(0, 432, 640, 48)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 16
self.back_opacity = 160
@text = []
refresh
end
#--------------------------------------------------------------------------
# â— Refreshes console input window.
#--------------------------------------------------------------------------
def refresh
$log = @text.to_s
self.contents.clear
self.contents.draw_text(0, -16, 620, 48, "]" + @text.to_s + "_")
end
#--------------------------------------------------------------------------
# â— Refreshes console input window.
#--------------------------------------------------------------------------
def add(char)
if @text.size >= 80
$game_system.se_play($data_system.buzzer_se)
else
@text.push(char.to_s)
refresh
end
end
#--------------------------------------------------------------------------
# â— Refreshes console input window.
#--------------------------------------------------------------------------
def clear
@text = []
refresh
end
#--------------------------------------------------------------------------
# â— Updates input console window.
#--------------------------------------------------------------------------
def update
# Sends console message.
if Input.getkey(13)
if @text.size == 0
$game_system.se_play($data_system.buzzer_se)
else
@text.clear
refresh
end
end
# Removes last entry in test.
if Input.getkey(8)
if @text.size == 0
$game_system.se_play($data_system.buzzer_se)
else
@text.delete_at(-1)
refresh
end
end
# Adds a pressed key.
if Input.getstate(16)
add("A") if Input.getkey(65)
add("B") if Input.getkey(66)
add("C") if Input.getkey(67)
add("D") if Input.getkey(68)
add("E") if Input.getkey(69)
add("F") if Input.getkey(70)
add("G") if Input.getkey(71)
add("H") if Input.getkey(72)
add("I") if Input.getkey(73)
add("J") if Input.getkey(74)
add("K") if Input.getkey(75)
add("L") if Input.getkey(76)
add("M") if Input.getkey(77)
add("N") if Input.getkey(78)
add("O") if Input.getkey(79)
add("P") if Input.getkey(80)
add("Q") if Input.getkey(81)
add("R") if Input.getkey(82)
add("S") if Input.getkey(83)
add("T") if Input.getkey(84)
add("U") if Input.getkey(85)
add("V") if Input.getkey(86)
add("W") if Input.getkey(87)
add("X") if Input.getkey(88)
add("Y") if Input.getkey(89)
add("Z") if Input.getkey(90)
add(")") if Input.getkey(48)
add("!") if Input.getkey(49)
add("@") if Input.getkey(50)
add("#") if Input.getkey(51)
add("$") if Input.getkey(52)
add("%") if Input.getkey(53)
add("^") if Input.getkey(54)
add("&") if Input.getkey(55)
add("*") if Input.getkey(56)
add("(") if Input.getkey(57)
add(":") if Input.getkey(186)
add("+") if Input.getkey(187)
add("<") if Input.getkey(188)
add("_") if Input.getkey(189)
add(">") if Input.getkey(190)
add("?") if Input.getkey(191)
add("{") if Input.getkey(219)
add("|") if Input.getkey(220)
add("}") if Input.getkey(221)
add("\"") if Input.getkey(222)
else
add("a") if Input.getkey(65)
add("b") if Input.getkey(66)
add("c") if Input.getkey(67)
add("d") if Input.getkey(68)
add("e") if Input.getkey(69)
add("f") if Input.getkey(70)
add("g") if Input.getkey(71)
add("h") if Input.getkey(72)
add("i") if Input.getkey(73)
add("j") if Input.getkey(74)
add("k") if Input.getkey(75)
add("l") if Input.getkey(76)
add("m") if Input.getkey(77)
add("n") if Input.getkey(78)
add("o") if Input.getkey(79)
add("p") if Input.getkey(80)
add("q") if Input.getkey(81)
add("r") if Input.getkey(82)
add("s") if Input.getkey(83)
add("t") if Input.getkey(84)
add("u") if Input.getkey(85)
add("v") if Input.getkey(86)
add("w") if Input.getkey(87)
add("x") if Input.getkey(88)
add("y") if Input.getkey(89)
add("z") if Input.getkey(90)
add("0") if Input.getkey(48)
add("1") if Input.getkey(49)
add("2") if Input.getkey(50)
add("3") if Input.getkey(51)
add("4") if Input.getkey(52)
add("5") if Input.getkey(53)
add("6") if Input.getkey(54)
add("7") if Input.getkey(55)
add("8") if Input.getkey(56)
add("9") if Input.getkey(57)
add(";") if Input.getkey(186)
add("=) if Input.getkey(187)
add(",") if Input.getkey(188)
add("-") if Input.getkey(189)
add(".") if Input.getkey(190)
add("/") if Input.getkey(191)
add("[") if Input.getkey(219)
add("\\") if Input.getkey(220)
add(]") if Input.getkey(221)
add("'") if Input.getkey(222)
end
add(" ") if Input.getkey(32)
add("*") if Input.getkey(106)
add("+") if Input.getkey(107)
add("-") if Input.getkey(109)
add("/") if Input.getkey(111)
end
end
#=============================================================================
# â– Scene_Console
#-----------------------------------------------------------------------------
#  Creates the console.
#=============================================================================
class Scene_Console
def main
@spriteset = Spriteset_Map.new
@console_window = Window_Console.new
@input_window = Window_ConsoleInput.new
Graphics.transition
loop do
Graphics.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@console_window.dispose
@input_window.dispose
end
def update
if Input.getkey(13)
CONSOLE.update($log)
@input_window.clear
end
@console_window.update
@input_window.update
if Input.getkey(27)
$scene = Scene_Map.new
end
end
end
class Scene_Map
alias console_update update
def update
console_update
if Input.getkey(222)#if Input.trigger?(Input::SHIFT)
if $DEBUG
$scene = Scene_Console.new
end
end
end
end
class Scene_Title
alias console_new_game command_new_game
def command_new_game
$console_commands = Console_Commands.new
console_new_game
end
end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
Instructions
Copy the script above and past it above main, under all other scripts.
Call the scene with $scene = Scene_Console.new
FAQ
Q. How do you call the console?
A. Just press shift! (I will add the tild key soon)
Compatibility
Should be compatible with all script.
Credits and Thanks
Cybersam for his Full Keyboard Support module
Please, credit me ^_^
Author's Notes
The console scene is based on the chat scene in the first Netplay script.
Enjoy! ^_^